Esempio n. 1
0
 /**
  * Construct this view
  * @param joppa\model\Node $node the node which is to be rendered
  * @param string $title title of the site (optional)
  * @return null
  */
 public function __construct(Node $node, $title = null)
 {
     $theme = $node->getTheme();
     $template = $theme->getTemplate();
     parent::__construct(null, $template);
     $resourceHandler = new ThemedResourceHandler($theme->getName());
     $this->setResourceHandler($resourceHandler);
     $style = $theme->getStyle();
     if ($style) {
         $this->addStyle($style);
     }
     if ($title) {
         $this->setTitle($title);
         $this->setPageTitle($node->name);
     } else {
         $this->setTitle($node->name);
     }
     $localeSuffix = '.' . $node->dataLocale;
     $metaDescription = $node->settings->get(NodeSettingModel::SETTING_META_DESCRIPTION . $localeSuffix);
     if ($metaDescription) {
         $this->addMeta(new Meta(Meta::DESCRIPTION, $metaDescription));
     }
     $metaKeywords = $node->settings->get(NodeSettingModel::SETTING_META_KEYWORDS . $localeSuffix);
     if ($metaKeywords) {
         $this->addMeta(new Meta(Meta::KEYWORDS, $metaKeywords));
     }
     $this->node = $node;
 }
Esempio n. 2
0
 /**
  * Construct the dispatcher
  * @param joppa\model\Node $node
  * @param joppa\view\frontend\NodeView $nodeView
  * @return null
  */
 public function __construct(Node $node, NodeView $nodeView)
 {
     $this->node = $node;
     $this->nodeView = $nodeView;
     $this->widgetDispatcher = new WidgetDispatcher();
     $this->regions = $node->getTheme()->getRegions();
     foreach ($this->regions as $regionName => $region) {
         $this->regions[$regionName] = $node->getWidgets($regionName);
     }
 }