API Documentation

View/Helper/Navigation.php

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_View  
subpackage
Helper  
version
$Id: Navigation.php 23953 2011-05-03 05:47:39Z ralph $  

\Zend_View_Helper_Navigation

Proxy helper for retrieving navigational helpers and forwarding calls

Extends from
\Zend_View_Helper_Navigation_HelperAbstract
category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_View  
subpackage
Helper  

Constants

Constantstring  NS = 'Zend_View_Helper_Navigation'

View helper namespace

string

Properties

Propertyprotectedstring  $_defaultProxy= 'menu'

Default proxy to use in {@link render()}

Default valuemenuDetails
Type
string
Propertyprotectedarray  $_helpers= 'array'

Contains references to proxied helpers

Default valuearrayDetails
Type
array
Propertyprotectedbool  $_injectAcl= 'true'

Whether ACL should be injected when proxying

Default valuetrueDetails
Type
bool
Propertyprotectedbool  $_injectContainer= 'true'

Whether container should be injected when proxying

Default valuetrueDetails
Type
bool
Propertyprotectedbool  $_injectTranslator= 'true'

Whether translator should be injected when proxying

Default valuetrueDetails
Type
bool

Methods

methodpublic__call( string $method, array $arguments = array ) : mixed

Magic overload: Proxy to other navigation helpers or the container

Examples of usage from a view script or layout:

// proxy to Menu helper and render container:
echo $this->navigation()->menu();

// proxy to Breadcrumbs helper and set indentation:
$this->navigation()->breadcrumbs()->setIndent(8);

// proxy to container and find all pages with 'blog' route:
$blogPages = $this->navigation()->findAllByRoute('blog');
Parameters
Name Type Description
$method string helper name or method name in container
$arguments array

[optional] arguments to pass

Returns
Type Description
mixed returns what the proxied call returns
Throws
Exception Description
\Zend_View_Exception if proxying to a helper, and the helper is not an instance of the interface specified in {@link findHelper()}
\Zend_Navigation_Exception if method does not exist in container
methodpublic__toString( ) : string

Magic overload: Proxy to {@link render()}.

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::__toString()

This method will trigger an E_USER_ERROR if rendering the helper causes an exception to be thrown.

Implements {@link Zend_View_Helper_Navigation_Helper::__toString()}.

Returns
Type Description
string
methodprotected_acceptAcl( \Zend_Navigation_Page $page ) : bool

Determines whether a page should be accepted by ACL when iterating

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::_acceptAcl()

Rules: - If helper has no ACL, page is accepted - If page has a resource or privilege defined, page is accepted if the ACL allows access to it using the helper's role - If page has no resource or privilege, page is accepted

Parameters
Name Type Description
$page \Zend_Navigation_Page page to check
Returns
Type Description
bool whether page is accepted by ACL
methodprotected_getWhitespace( int|string $indent ) : string

Retrieve whitespace representation of $indent

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::_getWhitespace()
Parameters
Name Type Description
$indent int|string
Returns
Type Description
string
methodprotected_htmlAttribs( array $attribs ) : string

Converts an associative array to a string of tag attributes.

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::_htmlAttribs()

Overloads {@link Zend_View_Helper_HtmlElement::_htmlAttribs()}.

Parameters
Name Type Description
$attribs array

an array where each key-value pair is converted to an attribute name and value

Returns
Type Description
string an attribute string
methodprotected_inject( \Zend_View_Helper_Navigation_Helper $helper ) : void

Injects container, ACL, and translator to the given $helper if this helper is configured to do so

Parameters
Name Type Description
$helper \Zend_View_Helper_Navigation_Helper helper instance
methodprotected_isStrictDoctype( ) : boolean

Is doctype strict?

Inherited from: \Zend_View_Helper_HtmlElement::_isStrictDoctype()
Returns
Type Description
boolean
methodprotected_isXhtml( ) : boolean

Is doctype XHTML?

Inherited from: \Zend_View_Helper_HtmlElement::_isXhtml()
Returns
Type Description
boolean
methodprotected_normalizeId( string $value ) : string

Overrides {@link Zend_View_Helper_HtmlElement::_normalizeId()}.

Parameters
Name Type Description
$value string
Returns
Type Description
string
methodpublicaccept( \Zend_Navigation_Page $page, bool $recursive = true ) : bool

Determines whether a page should be accepted when iterating

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::accept()

Rules: - If a page is not visible it is not accepted, unless RenderInvisible has been set to true. - If helper has no ACL, page is accepted - If helper has ACL, but no role, page is not accepted - If helper has ACL and role: - Page is accepted if it has no resource or privilege - Page is accepted if ACL allows page's resource or privilege - If page is accepted by the rules above and $recursive is true, the page will not be accepted if it is the descendant of a non-accepted page.

Parameters
Name Type Description
$page \Zend_Navigation_Page page to check
$recursive bool

[optional] if true, page will not be accepted if it is the descendant of a page that is not accepted. Default is true.

Returns
Type Description
bool whether page should be accepted
methodpublicdirect( ) : void

Strategy pattern: currently unutilized

Inherited from: \Zend_View_Helper_Abstract::direct()
methodpublicfindActive( \Zend_Navigation_Container $container, int|null|int|null $minDepth = null,  $maxDepth ) : array

Finds the deepest active page in the given container

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::findActive()
Parameters
Name Type Description
$container \Zend_Navigation_Container container to search
$minDepth int|null|int|null

[optional] minimum depth required for page to be valid. Default is to use {@link getMinDepth()}. A null value means no minimum depth required.

$maxDepth
Returns
Type Description
array an associative array with the values 'depth' and 'page', or an empty array if not found
methodpublicfindHelper( string $proxy, bool $strict = true ) : \Zend_View_Helper_Navigation_Helper

Returns the helper matching $proxy

The helper must implement the interface {@link Zend_View_Helper_Navigation_Helper}.

Parameters
Name Type Description
$proxy string helper name
$strict bool

[optional] whether exceptions should be thrown if something goes wrong. Default is true.

Returns
Type Description
\Zend_View_Helper_Navigation_Helper helper instance
Throws
Exception Description
\Zend_Loader_PluginLoader_Exception if $strict is true and helper cannot be found
\Zend_View_Exception if $strict is true and helper does not implement the specified interface
methodpublicgetAcl( ) : \Zend_Acl|null

Returns ACL or null if it isn't set using {@link setAcl()} or {@link setDefaultAcl()}

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::getAcl()

Implements {@link Zend_View_Helper_Navigation_Helper::getAcl()}.

Returns
Type Description
\Zend_Aclnull ACL object or null
methodpublicgetClosingBracket( ) : string

Get the tag closing bracket

Inherited from: \Zend_View_Helper_HtmlElement::getClosingBracket()
Returns
Type Description
string
methodpublicgetContainer( ) : \Zend_Navigation_Container

Returns the navigation container helper operates on by default

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::getContainer()

Implements {@link Zend_View_Helper_Navigation_Interface::getContainer()}.

If a helper is not explicitly set in this helper instance by calling {@link setContainer()} or by passing it through the helper entry point, this method will look in {@link Zend_Registry} for a container by using the key 'Zend_Navigation'.

If no container is set, and nothing is found in Zend_Registry, a new container will be instantiated and stored in the helper.

Returns
Type Description
\Zend_Navigation_Container navigation container
methodpublicgetDefaultProxy( ) : string

Returns the default proxy to use in {@link render()}

Returns
Type Description
string the default proxy to use in {@link render()}
methodpublicgetIndent( ) : string

Returns indentation

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::getIndent()
Returns
Type Description
string
methodpublicgetInjectAcl( ) : bool

Returns whether ACL should be injected when proxying

Returns
Type Description
bool whether ACL should be injected when proxying
methodpublicgetInjectContainer( ) : bool

Returns whether container should be injected when proxying

Returns
Type Description
bool whether container should be injected when proxying
methodpublicgetInjectTranslator( ) : bool

Returns whether translator should be injected when proxying

Returns
Type Description
bool whether translator should be injected when proxying
methodpublicgetMaxDepth( ) : int|null

Returns maximum depth a page can have to be included when rendering

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::getMaxDepth()
Returns
Type Description
intnull maximum depth or null
methodpublicgetMinDepth( ) : int|null

Returns minimum depth a page must have to be included when rendering

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::getMinDepth()
Returns
Type Description
intnull minimum depth or null
methodpublicgetRenderInvisible( ) : bool

Return renderInvisible flag

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::getRenderInvisible()
Returns
Type Description
bool
methodpublicgetRole( ) : string|\Zend_Acl_Role_Interface|null

Returns ACL role to use when iterating pages, or null if it isn't set using {@link setRole()} or {@link setDefaultRole()}

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::getRole()

Implements {@link Zend_View_Helper_Navigation_Helper::getRole()}.

Returns
Type Description
string\Zend_Acl_Role_Interfacenull role or null
methodpublicgetTranslator( ) : \Zend_Translate_Adapter|null

Returns translator used in helper

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::getTranslator()

Implements {@link Zend_View_Helper_Navigation_Helper::getTranslator()}.

Returns
Type Description
\Zend_Translate_Adapternull translator or null
methodpublicgetUseAcl( ) : bool

Returns whether ACL should be used

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::getUseAcl()

Implements {@link Zend_View_Helper_Navigation_Helper::getUseAcl()}.

Returns
Type Description
bool whether ACL should be used
methodpublicgetUseTranslator( ) : bool

Returns whether translator should be used

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::getUseTranslator()

Implements {@link Zend_View_Helper_Navigation_Helper::getUseTranslator()}.

Returns
Type Description
bool whether translator should be used
methodpublichasAcl( ) : bool

Checks if the helper has an ACL instance

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::hasAcl()

Implements {@link Zend_View_Helper_Navigation_Helper::hasAcl()}.

Returns
Type Description
bool whether the helper has a an ACL instance or not
methodpublichasContainer( ) : bool

Checks if the helper has a container

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::hasContainer()

Implements {@link Zend_View_Helper_Navigation_Helper::hasContainer()}.

Returns
Type Description
bool whether the helper has a container or not
methodpublichasRole( ) : bool

Checks if the helper has an ACL role

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::hasRole()

Implements {@link Zend_View_Helper_Navigation_Helper::hasRole()}.

Returns
Type Description
bool whether the helper has a an ACL role or not
methodpublichasTranslator( ) : bool

Checks if the helper has a translator

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::hasTranslator()

Implements {@link Zend_View_Helper_Navigation_Helper::hasTranslator()}.

Returns
Type Description
bool whether the helper has a translator or not
methodpublichtmlify( \Zend_Navigation_Page $page ) : string

Returns an HTML string containing an 'a' element for the given page

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::htmlify()
Parameters
Name Type Description
$page \Zend_Navigation_Page page to generate HTML for
Returns
Type Description
string HTML string for the given page
methodpublicnavigation( \Zend_Navigation_Container $container = null ) : \Zend_View_Helper_Navigation

Helper entry point

Parameters
Name Type Description
$container \Zend_Navigation_Container

[optional] container to operate on

Returns
Type Description
\Zend_View_Helper_Navigation fluent interface, returns self
methodpublicrender( \Zend_Navigation_Container $container = null ) : string

Renders helper

Parameters
Name Type Description
$container \Zend_Navigation_Container

[optional] container to render. Default is to render the container registered in the helper.

Returns
Type Description
string helper output
Throws
Exception Description
\Zend_Loader_PluginLoader_Exception if helper cannot be found
\Zend_View_Exception if helper doesn't implement the interface specified in {@link findHelper()}
methodpublicsetAcl( \Zend_Acl $acl = null ) : \Zend_View_Helper_Navigation_HelperAbstract

Sets ACL to use when iterating pages

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::setAcl()

Implements {@link Zend_View_Helper_Navigation_Helper::setAcl()}.

Parameters
Name Type Description
$acl \Zend_Acl

[optional] ACL object. Default is null.

Returns
Type Description
\Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self
methodpublicsetContainer( \Zend_Navigation_Container $container = null ) : \Zend_View_Helper_Navigation_HelperAbstract

Sets navigation container the helper operates on by default

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::setContainer()

Implements {@link Zend_View_Helper_Navigation_Interface::setContainer()}.

Parameters
Name Type Description
$container \Zend_Navigation_Container

[optional] container to operate on. Default is null, meaning container will be reset.

Returns
Type Description
\Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self
methodpublicsetDefaultAcl( \Zend_Acl $acl = null ) : void
static

Sets default ACL to use if another ACL is not explicitly set

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::setDefaultAcl()
Parameters
Name Type Description
$acl \Zend_Acl

[optional] ACL object. Default is null, which sets no ACL object.

methodpublicsetDefaultProxy( string $proxy ) : \Zend_View_Helper_Navigation

Sets the default proxy to use in {@link render()}

Parameters
Name Type Description
$proxy string default proxy
Returns
Type Description
\Zend_View_Helper_Navigation fluent interface, returns self
methodpublicsetDefaultRole( \midex $role = null ) : void
static

Sets default ACL role(s) to use when iterating pages if not explicitly set later with {@link setRole()}

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::setDefaultRole()
Parameters
Name Type Description
$role \midex

[optional] role to set. Expects null, string, or an instance of {@link Zend_Acl_Role_Interface}. Default is null, which sets no default role.

Throws
Exception Description
\Zend_View_Exception if role is invalid
methodpublicsetIndent( string|int $indent ) : \Zend_View_Helper_Navigation_HelperAbstract

Set the indentation string for using in {@link render()}, optionally a number of spaces to indent with

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::setIndent()
Parameters
Name Type Description
$indent string|int indentation string or number of spaces
Returns
Type Description
\Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self
methodpublicsetInjectAcl( bool $injectAcl = true ) : \Zend_View_Helper_Navigation

Sets whether ACL should be injected when proxying

Parameters
Name Type Description
$injectAcl bool

[optional] whether ACL should be injected when proxying. Default is true.

Returns
Type Description
\Zend_View_Helper_Navigation fluent interface, returns self
methodpublicsetInjectContainer( bool $injectContainer = true ) : \Zend_View_Helper_Navigation

Sets whether container should be injected when proxying

Parameters
Name Type Description
$injectContainer bool

[optional] whether container should be injected when proxying. Default is true.

Returns
Type Description
\Zend_View_Helper_Navigation fluent interface, returns self
methodpublicsetInjectTranslator( bool $injectTranslator = true ) : \Zend_View_Helper_Navigation

Sets whether translator should be injected when proxying

Parameters
Name Type Description
$injectTranslator bool

[optional] whether translator should be injected when proxying. Default is true.

Returns
Type Description
\Zend_View_Helper_Navigation fluent interface, returns self
methodpublicsetMaxDepth( int $maxDepth = null ) : \Zend_View_Helper_Navigation_HelperAbstract

Sets the maximum depth a page can have to be included when rendering

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::setMaxDepth()
Parameters
Name Type Description
$maxDepth int

[optional] maximum depth. Default is null, which sets no maximum depth.

Returns
Type Description
\Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self
methodpublicsetMinDepth( int $minDepth = null ) : \Zend_View_Helper_Navigation_HelperAbstract

Sets the minimum depth a page must have to be included when rendering

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::setMinDepth()
Parameters
Name Type Description
$minDepth int

[optional] minimum depth. Default is null, which sets no minimum depth.

Returns
Type Description
\Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self
methodpublicsetRenderInvisible( bool $renderInvisible = true ) : \Zend_View_Helper_Navigation_HelperAbstract
Parameters
Name Type Description
$renderInvisible bool

[optional] boolean flag

Returns
Type Description
\Zend_View_Helper_Navigation_HelperAbstract fluent interface returns self
methodpublicsetRole( mixed $role = null ) : \Zend_View_Helper_Navigation_HelperAbstract

Sets ACL role(s) to use when iterating pages

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::setRole()

Implements {@link Zend_View_Helper_Navigation_Helper::setRole()}.

Parameters
Name Type Description
$role mixed

[optional] role to set. Expects a string, an instance of type {@link Zend_Acl_Role_Interface}, or null. Default is null, which will set no role.

Returns
Type Description
\Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self
Throws
Exception Description
\Zend_View_Exception if $role is invalid
methodpublicsetTranslator( mixed $translator = null ) : \Zend_View_Helper_Navigation_HelperAbstract

Sets translator to use in helper

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::setTranslator()

Implements {@link Zend_View_Helper_Navigation_Helper::setTranslator()}.

Parameters
Name Type Description
$translator mixed

[optional] translator. Expects an object of type {@link Zend_Translate_Adapter} or {@link Zend_Translate}, or null. Default is null, which sets no translator.

Returns
Type Description
\Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self
methodpublicsetUseAcl( bool $useAcl = true ) : \Zend_View_Helper_Navigation_HelperAbstract

Sets whether ACL should be used

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::setUseAcl()

Implements {@link Zend_View_Helper_Navigation_Helper::setUseAcl()}.

Parameters
Name Type Description
$useAcl bool

[optional] whether ACL should be used. Default is true.

Returns
Type Description
\Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self
methodpublicsetUseTranslator( bool $useTranslator = true ) : \Zend_View_Helper_Navigation_HelperAbstract

Sets whether translator should be used

Inherited from: \Zend_View_Helper_Navigation_HelperAbstract::setUseTranslator()

Implements {@link Zend_View_Helper_Navigation_Helper::setUseTranslator()}.

Parameters
Name Type Description
$useTranslator bool

[optional] whether translator should be used. Default is true.

Returns
Type Description
\Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self
methodpublicsetView( \Zend_View_Interface $view ) : \Zend_View_Helper_Abstract

Set the View object

Inherited from: \Zend_View_Helper_Abstract::setView()
Parameters
Name Type Description
$view \Zend_View_Interface
Returns
Type Description
\Zend_View_Helper_Abstract
Documentation was generated by DocBlox 0.13.3.