/ */ class P4Cms_Navigation_Page_Mvc extends Zend_Navigation_Page_Mvc { protected $_encode = true; /** * Returns page label with support for macros. * * @return string page label or null */ public function getLabel() { return P4Cms_Navigation::expandMacros(parent::getLabel(), $this); } /** * Returns page title with support for macros. * * @return string|null page title or null */ public function getTitle() { return P4Cms_Navigation::expandMacros(parent::getTitle(), $this); } /** * Overwritten parent to allow assembling url with disabled encoding. Parent method * provided by Zend doesn't provide any option to disable href encoding, which is * needed in some cases (e.g. for category links). * * @return string page href */ public function getHref() { if ($this->_hrefCache) { return $this->_hrefCache; } if (null === self::$_urlHelper) { self::$_urlHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('Url'); } $params = $this->getParams(); if ($param = $this->getModule()) { $params['module'] = $param; } if ($param = $this->getController()) { $params['controller'] = $param; } if ($param = $this->getAction()) { $params['action'] = $param; } $url = self::$_urlHelper->url( $params, $this->getRoute(), $this->getResetParams(), $this->_encode ); return $this->_hrefCache = $url; } /** * Set whether to encode page href generated by getHref() method. * * @param boolean $encode if true then page href will be encoded, * otherwise page href will not be encoded * @return P4Cms_Navigation_Page_Mvc provides fluent interface */ public function setEncode($encode) { $this->_encode = (bool) $encode; $this->_hrefCache = null; return $this; } /** * Returns an array representation of the page * * @return array associative array containing all page properties */ public function toArray() { return array_merge( parent::toArray(), array( 'label' => $this->_label, 'title' => $this->_title ) ); } }