Perforce Chronicle 2012.2/486814
API Documentation

P4Cms_Navigation_Page_Mvc Class Reference

Extends Zend_Navigation_Page_Mvc to generate page href with optionally disabled encoding. More...

List of all members.

Public Member Functions

 getHref ()
 Overwritten parent to allow assembling url with disabled encoding.
 getLabel ()
 Returns page label with support for macros.
 getTitle ()
 Returns page title with support for macros.
 setEncode ($encode)
 Set whether to encode page href generated by getHref() method.
 toArray ()
 Returns an array representation of the page.

Protected Attributes

 $_encode = true

Detailed Description

Extends Zend_Navigation_Page_Mvc to generate page href with optionally disabled encoding.

Copyright:
2011-2012 Perforce Software. All rights reserved
License:
Please see LICENSE.txt in top-level folder of this distribution.
Version:
2012.2/486814

Member Function Documentation

P4Cms_Navigation_Page_Mvc::getHref ( )

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).

Returns:
string page href
    {
        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;
    }
P4Cms_Navigation_Page_Mvc::getLabel ( )

Returns page label with support for macros.

Returns:
string page label or null
    {
        return P4Cms_Navigation::expandMacros(parent::getLabel(), $this);
    }
P4Cms_Navigation_Page_Mvc::getTitle ( )

Returns page title with support for macros.

Returns:
string|null page title or null
    {
        return P4Cms_Navigation::expandMacros(parent::getTitle(), $this);
    }
P4Cms_Navigation_Page_Mvc::setEncode ( encode)

Set whether to encode page href generated by getHref() method.

Parameters:
boolean$encodeif true then page href will be encoded, otherwise page href will not be encoded
Returns:
P4Cms_Navigation_Page_Mvc provides fluent interface
    {
        $this->_encode    = (bool) $encode;
        $this->_hrefCache = null;

        return $this;
    }
P4Cms_Navigation_Page_Mvc::toArray ( )

Returns an array representation of the page.

Returns:
array associative array containing all page properties
    {
        return array_merge(
            parent::toArray(),
            array(
                'label' => $this->_label,
                'title' => $this->_title
            )
        );
    }

Member Data Documentation

P4Cms_Navigation_Page_Mvc::$_encode = true [protected]

The documentation for this class was generated from the following file: