Proxy helper for retrieving navigational helpers and forwarding calls

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

 Methods

Zend_View_Helper_Navigation_Breadcrumbs breadcrumbs

() : 
magic
method Zend_View_Helper_Navigation_Breadcrumbs breadcrumbs

Returns

Zend_View_Helper_Navigation_Links links

() : 
magic
method Zend_View_Helper_Navigation_Links links

Returns

Zend_View_Helper_Navigation_Menu menu

() : 
magic
method Zend_View_Helper_Navigation_Menu menu

Returns

Zend_View_Helper_Navigation_Sitemap sitemap

() : 
magic
method Zend_View_Helper_Navigation_Sitemap sitemap

Returns

Magic overload: Proxy to other navigation helpers or the container

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

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');

inherited_from \Zend_View_Helper_Navigation_HelperAbstract::__call()

Parameters

$method

string

helper name or method name in container

$arguments

array

[optional] arguments to pass

Exceptions

\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

Returns

mixedreturns what the proxied call returns

Magic overload: Proxy calls to the navigation container

__call(string $method, array $arguments = array()) : mixed
Inherited

Parameters

$method

string

method name in container

$arguments

array

[optional] arguments to pass

Exceptions

\Zend_Navigation_Exception if method does not exist in container

Returns

mixedreturns what the container returns

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

__toString() : string
Inherited

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

Implements Zend_View_Helper_Navigation_Helper::__toString().

inherited_from \Zend_View_Helper_Navigation_Helper::__toString()

Returns

string

Determines whether a page should be accepted when iterating

accept(\Zend_Navigation_Page $page, boolean $recursive = true) : boolean
Inherited

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

$page

\Zend_Navigation_Page

page to check

$recursive

boolean

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

Returns

booleanwhether page should be accepted

Strategy pattern: currently unutilized

direct() : void
Inherited
inherited_from \Zend_View_Helper_Interface::direct()

Finds the deepest active page in the given container

findActive(\Zend_Navigation_Container $container, integer|null $minDepth = null, $maxDepth = -1) : array
Inherited

Parameters

$container

\Zend_Navigation_Container

container to search

$minDepth

integernullintegernull

[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

arrayan associative array with the values 'depth' and 'page', or an empty array if not found

Returns the helper matching $proxy

findHelper(string $proxy, boolean $strict = true) : \Zend_View_Helper_Navigation_Helper

The helper must implement the interface Zend_View_Helper_Navigation_Helper.

Parameters

$proxy

string

helper name

$strict

boolean

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

Exceptions

\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

Returns

\Zend_View_Helper_Navigation_Helperhelper instance

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

getAcl() : \Zend_Acl | null
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::getAcl()

Returns

\Zend_AclnullACL object or null

Get the tag closing bracket

getClosingBracket() : string
Inherited

Returns

string

Returns the navigation container helper operates on by default

getContainer() : \Zend_Navigation_Container
Inherited

Implements \Zend_View_Helper_Navigation_Interface::getContainer().

If a helper is not explicitly set in this helper instance by calling \setContainer() or by passing it through the helper entry point, this method will look in 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.

inherited_from \Zend_View_Helper_Navigation_Helper::getContainer()

Returns

\Zend_Navigation_Containernavigation container

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

getDefaultProxy() : string

Returns

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

Returns the EOL character (format output is respected)

getEOL() : string
Inherited
see
see

Returns

stringstandard EOL charater or an empty string

Returns whether HTML/XML output should be formatted

getFormatOutput() : boolean
Inherited

Returns

booleanwhether HTML/XML output should be formatted

Returns indentation (format output is respected)

getIndent() : string
Inherited

Returns

stringindentation string or an empty string

Returns whether ACL should be injected when proxying

getInjectAcl() : boolean

Returns

booleanwhether ACL should be injected when proxying

Returns whether container should be injected when proxying

getInjectContainer() : boolean

Returns

booleanwhether container should be injected when proxying

Returns whether translator should be injected when proxying

getInjectTranslator() : boolean

Returns

booleanwhether translator should be injected when proxying

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

getMaxDepth() : integer | null
Inherited

Returns

integernullmaximum depth or null

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

getMinDepth() : integer | null
Inherited

Returns

integernullminimum depth or null

Returns prefix for IDs when they are normalized

getPrefixForId() : string
Inherited

Returns

stringPrefix for

Return renderInvisible flag

getRenderInvisible() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::getRenderInvisible()

Returns

boolean

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

getRole() : string | \Zend_Acl_Role_Interface | null
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::getRole()

Returns

string\Zend_Acl_Role_Interfacenullrole or null

Returns translator used in helper

getTranslator() : \Zend_Translate_Adapter | null
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::getTranslator()

Returns

\Zend_Translate_Adapternulltranslator or null

Returns whether ACL should be used

getUseAcl() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::getUseAcl()

Returns

booleanwhether ACL should be used

Returns whether translator should be used

getUseTranslator() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::getUseTranslator()

Returns

booleanwhether translator should be used

Checks if the helper has an ACL instance

hasAcl() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::hasAcl()

Returns

booleanwhether the helper has a an ACL instance or not

Checks if the helper has a container

hasContainer() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::hasContainer()

Returns

booleanwhether the helper has a container or not

Checks if the helper has an ACL role

hasRole() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::hasRole()

Returns

booleanwhether the helper has a an ACL role or not

Checks if the helper has a translator

hasTranslator() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::hasTranslator()

Returns

booleanwhether the helper has a translator or not

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

htmlify(\Zend_Navigation_Page $page) : string
Inherited

Parameters

$page

\Zend_Navigation_Page

page to generate HTML for

Returns

stringHTML string for the given page

Helper entry point

navigation(\Zend_Navigation_Container $container = null) : \Zend_View_Helper_Navigation

Parameters

$container

\Zend_Navigation_Container

[optional] container to operate on

Returns

\Zend_View_Helper_Navigationfluent interface, returns self

Renders helper

render(\Zend_Navigation_Container $container = null) : string

Parameters

$container

\Zend_Navigation_Container

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

Exceptions

\Zend_Loader_PluginLoader_Exception if helper cannot be found
\Zend_View_Exception if helper doesn't implement the interface specified in {@link findHelper()}

Returns

stringhelper output

Sets ACL to use when iterating pages

setAcl(\Zend_Acl $acl = null) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::setAcl()

Parameters

$acl

\Zend_Acl

[optional] ACL object. Default is null.

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets navigation container the helper operates on by default

setContainer(\Zend_Navigation_Container $container = null) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited

Implements \Zend_View_Helper_Navigation_Interface::setContainer().

inherited_from \Zend_View_Helper_Navigation_Helper::setContainer()

Parameters

$container

\Zend_Navigation_Container

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

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

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

setDefaultAcl(\Zend_Acl $acl = null) : void
InheritedStatic

Parameters

$acl

\Zend_Acl

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

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

setDefaultProxy(string $proxy) : \Zend_View_Helper_Navigation

Parameters

$proxy

string

default proxy

Returns

\Zend_View_Helper_Navigationfluent interface, returns self

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

setDefaultRole(mixed $role = null) : void
InheritedStatic

Parameters

$role

mixed

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

Exceptions

\Zend_View_Exception if role is invalid

Sets whether HTML/XML output should be formatted

setFormatOutput(boolean $formatOutput = true) : \Zend_View_Helper_Navigation_Sitemap
Inherited

Parameters

$formatOutput

boolean

[optional] whether output should be formatted. Default is true.

Returns

\Zend_View_Helper_Navigation_Sitemapfluent interface, returns self

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

setIndent(string|integer $indent) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited

Parameters

$indent

stringinteger

indentation string or number of spaces

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets whether ACL should be injected when proxying

setInjectAcl(boolean $injectAcl = true) : \Zend_View_Helper_Navigation

Parameters

$injectAcl

boolean

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

Returns

\Zend_View_Helper_Navigationfluent interface, returns self

Sets whether container should be injected when proxying

setInjectContainer(boolean $injectContainer = true) : \Zend_View_Helper_Navigation

Parameters

$injectContainer

boolean

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

Returns

\Zend_View_Helper_Navigationfluent interface, returns self

Sets whether translator should be injected when proxying

setInjectTranslator(boolean $injectTranslator = true) : \Zend_View_Helper_Navigation

Parameters

$injectTranslator

boolean

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

Returns

\Zend_View_Helper_Navigationfluent interface, returns self

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

setMaxDepth(integer $maxDepth = null) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited

Parameters

$maxDepth

integer

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

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

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

setMinDepth(integer $minDepth = null) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited

Parameters

$minDepth

integer

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

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets prefix for IDs when they are normalized

setPrefixForId(string $prefix) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited

Parameters

$prefix

string

Prefix for IDs

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Render invisible items?

setRenderInvisible(boolean $renderInvisible = true) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::setRenderInvisible()

Parameters

$renderInvisible

boolean

[optional] boolean flag

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface returns self

Sets ACL role(s) to use when iterating pages

setRole(mixed $role = null) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::setRole()

Parameters

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

Exceptions

\Zend_View_Exception if $role is invalid

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets translator to use in helper

setTranslator(mixed $translator = null) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::setTranslator()

Parameters

$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

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets whether ACL should be used

setUseAcl(boolean $useAcl = true) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::setUseAcl()

Parameters

$useAcl

boolean

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

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets whether translator should be used

setUseTranslator(boolean $useTranslator = true) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::setUseTranslator()

Parameters

$useTranslator

boolean

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

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Set the View object

setView(\Zend_View_Interface $view) : \Zend_View_Helper_Abstract
Inherited
inherited_from \Zend_View_Helper_Interface::setView()

Parameters

$view

\Zend_View_Interface

Returns

\Zend_View_Helper_Abstract

Skip the current prefix for IDs when they are normalized

skipPrefixForId(boolean $flag = true) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited

Parameters

$flag

boolean

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Determines whether a page should be accepted by ACL when iterating

_acceptAcl(\Zend_Navigation_Page $page) : boolean
Inherited

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

$page

\Zend_Navigation_Page

page to check

Returns

booleanwhether page is accepted by ACL

Retrieve whitespace representation of $indent

_getWhitespace(integer|string $indent) : string
Inherited

Parameters

$indent

integerstring

Returns

string

Converts an associative array to a string of tag attributes.

_htmlAttribs(array $attribs) : string
Inherited
access public

Parameters

$attribs

array

From this array, each key-value pair is converted to an attribute name and value.

Returns

stringThe XHTML for the attributes.

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

_inject(\Zend_View_Helper_Navigation_Helper $helper) : void

Parameters

$helper

\Zend_View_Helper_Navigation_Helper

helper instance

Is doctype HTML5?

_isHtml5() : boolean
Inherited

Returns

boolean

Is doctype strict?

_isStrictDoctype() : boolean
Inherited

Returns

boolean

Is doctype XHTML?

_isXhtml() : boolean
Inherited

Returns

boolean

Normalize an ID

_normalizeId(string $value) : string
Inherited

Parameters

$value

string

Returns

string

 Properties

 

View object

$view : \Zend_View_Interface

Default

null
 

ACL to use when iterating pages

$_acl : \Zend_Acl

Default

 

The tag closing bracket

$_closingBracket : string

Default

null
 

Container to operate on by default

$_container : \Zend_Navigation_Container

Default

 

Default ACL to use when iterating pages if not explicitly set in the instance by calling {@link setAcl()}

$_defaultAcl : \Zend_Acl

Default

Static
 

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

$_defaultProxy : string

Default

'menu'
 

Default ACL role to use when iterating pages if not explicitly set in the instance by calling {@link setRole()}

$_defaultRole : string | \Zend_Acl_Role_Interface

Default

Static
 

Whether HTML/XML output should be formatted

$_formatOutput : boolean

Default

true
 

Contains references to proxied helpers

$_helpers : array

Default

array()
 

Indentation string

$_indent : string

Default

''
 

Whether ACL should be injected when proxying

$_injectAcl : boolean

Default

true
 

Whether container should be injected when proxying

$_injectContainer : boolean

Default

true
 

Whether translator should be injected when proxying

$_injectTranslator : boolean

Default

true
 

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

$_maxDepth : integer

Default

 

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

$_minDepth : integer

Default

 

Prefix for IDs when they are normalized

$_prefixForId : string | null

Default

null
 

Wheter invisible items should be rendered by this helper

$_renderInvisible : boolean

Default

false
 

ACL role to use when iterating pages

$_role : string | \Zend_Acl_Role_Interface

Default

 

Skip current prefix for IDs when they are normalized (flag)

$_skipPrefixForId : boolean

Default

false
 

Translator

$_translator : \Zend_Translate_Adapter

Default

 

Whether ACL should be used for filtering out pages

$_useAcl : boolean

Default

true
 

Whether translator should be used for page labels and titles

$_useTranslator : boolean

Default

true

 Constants

 

EOL character

EOL = "\n" 
 

View helper namespace

NS = 'Zend_View_Helper_Navigation' : string