/** * If the current page is not to a category menu item, set metadata */ protected function _preparePage() { if ($this->getName() === $this->getActiveMenu()->query['view']) { $category = $this->getModel()->fetch(); $slug = isset($this->getActiveMenu()->query['slug']) ? $this->getActiveMenu()->query['slug'] : null; if ($category->slug !== $slug) { $helper = $this->getTemplate()->createHelper('string'); $this->getParameters()->{'menu-meta_description'} = $helper->truncate(array( 'text' => $category->description, 'length' => 140 )); } } parent::_preparePage(); }
/** * If the current page is not to a document menu item, set metadata */ protected function _preparePage() { if ($this->getName() !== $this->getActiveMenu()->query['view']) { $helper = $this->getTemplate()->createHelper('string'); $document = $this->getModel()->fetch(); $this->getParameters()->{'menu-meta_description'} = $helper->truncate(array( 'text' => $document->description, 'length' => 140 )); } parent::_preparePage(); }