Base class for navigational helpers

 Methods

Magic overload: Proxy calls to the navigation container

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

Parameters

$method

string

method name in container

$arguments

array

[optional] arguments to pass

Exceptions

\Zend\Navigation\Exception\ExceptionInterface if method does not exist in container

Returns

mixedreturns what the container returns

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

__toString() : string

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

Implements HelperInterface::__toString().

Returns

string

Determines whether a page should be accepted when iterating

accept(\Zend\Navigation\Page\AbstractPage $page, bool $recursive) : bool

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

$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

boolwhether page should be accepted

Finds the deepest active page in the given container

findActive(\Zend\Navigation\AbstractContainer $container, int | null $minDepth, int | null $maxDepth) : array

Parameters

$container

\Zend\Navigation\AbstractContainer

container to search

$minDepth

intnull

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

$maxDepth

intnull

[optional] maximum depth a page can have to be valid. Default is to use {@link getMaxDepth()}. A null value means no maximum depth required.

Returns

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

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

getAcl() : \Zend\Permissions\Acl\AclInterface | null

Implements HelperInterface::getAcl().

Returns

\Zend\Permissions\Acl\AclInterfacenullACL object or null

Get the tag closing bracket

getClosingBracket() : string
Inherited

inherited_from \Zend\View\Helper\AbstractHtmlElement::getClosingBracket()

Returns

string

Returns the navigation container helper operates on by default

getContainer() : \Zend\Navigation\AbstractContainer

Implements HelperInterface::getContainer().

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

Returns

Returns indentation

getIndent() : string

Returns

string

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

getMaxDepth() : int | null

Returns

intnullmaximum depth or null

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

getMinDepth() : int | null

Returns

intnullminimum depth or null

Return renderInvisible flag

getRenderInvisible() : bool

Returns

bool

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

getRole() : string | \Zend\Permissions\Acl\Role\RoleInterface | null

Implements HelperInterface::getRole().

Returns

Get the service locator.

getServiceLocator() : \Zend\ServiceManager\ServiceLocatorInterface

Returns translator used in helper

getTranslator() : \Zend\I18n\Translator\Translator | null

Return the translation text domain

getTranslatorTextDomain() : string

Returns

string

Returns whether ACL should be used

getUseAcl() : bool

Implements HelperInterface::getUseAcl().

Returns

boolwhether ACL should be used

Get the view object

getView() : null | \Zend\View\Renderer\RendererInterface
Inherited

inherited_from \Zend\View\Helper\AbstractHelper::getView()
inherited_from \Zend\View\Helper\AbstractHtmlElement::getView()

Returns

Checks if the helper has an ACL instance

hasAcl() : bool

Implements HelperInterface::hasAcl().

Returns

boolwhether the helper has a an ACL instance or not

Checks if the helper has a container

hasContainer() : bool

Implements HelperInterface::hasContainer().

Returns

boolwhether the helper has a container or not

Checks if the helper has an ACL role

hasRole() : bool

Implements HelperInterface::hasRole().

Returns

boolwhether the helper has a an ACL role or not

Checks if the helper has a translator

hasTranslator() : bool

Returns

bool

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

htmlify(\Zend\Navigation\Page\AbstractPage $page) : string

Parameters

$page

\Zend\Navigation\Page\AbstractPage

page to generate HTML for

Returns

stringHTML string for the given page

Returns whether translator is enabled and should be used

isTranslatorEnabled() : bool

Returns

bool

Renders helper

render(string | \Zend\Navigation\AbstractContainer $container) : string
Inherited

inherited_from \Zend\View\Helper\Navigation\HelperInterface::render()

Parameters

$container

string\Zend\Navigation\AbstractContainer

[optional] container to render. Default is null, which indicates that the helper should render the container returned by {@link getContainer()}.

Exceptions

\Zend\View\Exception\ExceptionInterface if unable to render

Returns

stringhelper output

Sets ACL to use when iterating pages

setAcl(\Zend\Permissions\Acl\AclInterface $acl) : \Zend\View\Helper\Navigation\AbstractHelper

Implements HelperInterface::setAcl().

Parameters

$acl

\Zend\Permissions\Acl\AclInterface

[optional] ACL object. Default is null.

Returns

\Zend\View\Helper\Navigation\AbstractHelperfluent interface, returns self

Sets navigation container the helper operates on by default

setContainer(string | \Zend\Navigation\AbstractContainer $container) : \Zend\View\Helper\Navigation\AbstractHelper

Implements HelperInterface::setContainer().

Parameters

$container

string\Zend\Navigation\AbstractContainer

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

Returns

\Zend\View\Helper\Navigation\AbstractHelperfluent interface, returns self

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

setDefaultAcl(\Zend\Permissions\Acl\AclInterface $acl) : void

Parameters

$acl

\Zend\Permissions\Acl\AclInterface

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

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

setDefaultRole(mixed $role) : void

Parameters

$role

mixed

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

Exceptions

\Zend\View\Exception\InvalidArgumentException if role is invalid

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

setIndent(string | int $indent) : \Zend\View\Helper\Navigation\AbstractHelper

Parameters

$indent

stringint

indentation string or number of spaces

Returns

\Zend\View\Helper\Navigation\AbstractHelperfluent interface, returns self

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

setMaxDepth(int $maxDepth) : \Zend\View\Helper\Navigation\AbstractHelper

Parameters

$maxDepth

int

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

Returns

\Zend\View\Helper\Navigation\AbstractHelperfluent interface, returns self

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

setMinDepth(int $minDepth) : \Zend\View\Helper\Navigation\AbstractHelper

Parameters

$minDepth

int

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

Returns

\Zend\View\Helper\Navigation\AbstractHelperfluent interface, returns self

Render invisible items?

setRenderInvisible(bool $renderInvisible) : \Zend\View\Helper\Navigation\AbstractHelper

Parameters

$renderInvisible

bool

[optional] boolean flag

Returns

\Zend\View\Helper\Navigation\AbstractHelperfluent interface returns self

Sets ACL role(s) to use when iterating pages

setRole(mixed $role) : \Zend\View\Helper\Navigation\AbstractHelper

Implements HelperInterface::setRole().

Parameters

$role

mixed

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

Exceptions

\Zend\View\Exception\InvalidArgumentException if $role is invalid

Returns

\Zend\View\Helper\Navigation\AbstractHelperfluent interface, returns self

Set the service locator.

setServiceLocator(\Zend\ServiceManager\ServiceLocatorInterface $serviceLocator) : \Zend\View\Helper\Navigation\AbstractHelper

Sets translator to use in helper

setTranslator(\Zend\I18n\Translator\Translator $translator, string $textDomain) : \Zend\View\Helper\Navigation\AbstractHelper

Parameters

$translator

\Zend\I18n\Translator\Translator

[optional] translator. Default is null, which sets no translator.

$textDomain

string

[optional] text domain Default is null, which skips setTranslatorTextDomain

Returns

Sets whether translator is enabled and should be used

setTranslatorEnabled(bool $enabled) : \Zend\View\Helper\Navigation\AbstractHelper

Parameters

$enabled

bool

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

Returns

Set translation text domain

setTranslatorTextDomain(string $textDomain) : \Zend\View\Helper\Navigation\AbstractHelper

Parameters

$textDomain

string

Returns

Sets whether ACL should be used

setUseAcl(bool $useAcl) : \Zend\View\Helper\Navigation\AbstractHelper

Implements HelperInterface::setUseAcl().

Parameters

$useAcl

bool

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

Returns

\Zend\View\Helper\Navigation\AbstractHelperfluent interface, returns self

Set the View object

setView(\Zend\View\Renderer\RendererInterface $view) : \Zend\View\Helper\AbstractHelper
Inherited

inherited_from \Zend\View\Helper\AbstractHelper::setView()
inherited_from \Zend\View\Helper\AbstractHtmlElement::setView()

Parameters

Returns

Determines whether a page should be accepted by ACL when iterating

acceptAcl(\Zend\Navigation\Page\AbstractPage $page) : bool

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

Returns

boolwhether page is accepted by ACL

Retrieve whitespace representation of $indent

getWhitespace(int | string $indent) : string

Parameters

$indent

intstring

Returns

string

Converts an associative array to a string of tag attributes.

htmlAttribs(array $attribs) : string

Overloads View\Helper\AbstractHtmlElement::htmlAttribs().

Parameters

$attribs

array

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

Returns

stringan attribute string

Is doctype XHTML?

isXhtml() : bool
Inherited

inherited_from \Zend\View\Helper\AbstractHtmlElement::isXhtml()

Returns

bool

Normalize an ID

normalizeId(string $value) : string

Overrides View\Helper\AbstractHtmlElement::normalizeId().

Parameters

$value

string

Returns

string

Verifies container and eventually fetches it from service locator if it is a string

parseContainer(\Zend\Navigation\AbstractContainer | string | null $container) 

 Properties

 

ACL to use when iterating pages

$acl : \Zend\Permissions\Acl\AclInterface

 

The tag closing bracket

$closingBracket : string
Inherited

inherited_from \Zend\View\Helper\AbstractHtmlElement::$$closingBracket
 

AbstractContainer to operate on by default

$container : \Zend\Navigation\AbstractContainer

 

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

$defaultAcl : \Zend\Permissions\Acl\AclInterface

 

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

$defaultRole : string | \Zend\Permissions\Acl\Role\RoleInterface

 

Indentation string

$indent : string

 

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

$maxDepth : int

 

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

$minDepth : int

 

Whether invisible items should be rendered by this helper

$renderInvisible : bool

 

ACL role to use when iterating pages

$role : string | \Zend\Permissions\Acl\Role\RoleInterface

 

$serviceLocator

$serviceLocator : \Zend\ServiceManager\ServiceLocatorInterface

 

Translator (optional)

$translator : \Zend\I18n\Translator\Translator

 

Whether translator should be used

$translatorEnabled : bool

 

Translator text domain (optional)

$translatorTextDomain : string

 

Whether ACL should be used for filtering out pages

$useAcl : bool

 

View object

$view : \Zend\View\Renderer\RendererInterface
Inherited

inherited_from \Zend\View\Helper\AbstractHelper::$$view
inherited_from \Zend\View\Helper\AbstractHtmlElement::$$view

 Constants

 

EOL character

EOL 
Inherited

inherited_from \Zend\View\Helper\AbstractHtmlElement::EOL