示例#1
0
 /**
  * Render content inside layout
  *
  * @param Content $content Content object
  * @return string
  */
 public function render(Content $content, $vars = array())
 {
     $layout = $this->getLayout();
     if ($content->getName() != 'index') {
         if ($item = $this->getActiveNavigationItem()) {
             $layout->setTitle($item->getText());
         }
         if ($subItem = $this->getActiveSubNavigationItem()) {
             $layout->setTitle($subItem->getText());
         }
     }
     $layout->setTitle($content->getTitle());
     // Fetch all the metadata from the content and set it to the layout so
     // it can be accessed by the layout view template.
     foreach ($content->getMetadata() as $name => $value) {
         $layout->setParam($name, $value);
     }
     return $layout->render($content->render(), $vars);
 }