1236. Class

1236.1. Zend\View\Helper\Navigation\AbstractHelper

Base class for navigational helpers

1236.1.1. Methods

1236.1.1.1. setServiceLocator

setServiceLocator()

Set the service locator.

Parameters:ServiceLocatorInterface
Return type:AbstractHelper

1236.1.1.2. getServiceLocator

getServiceLocator()

Get the service locator.

Return type:ZendServiceManagerServiceLocatorInterface

1236.1.1.3. setContainer

setContainer()

Sets navigation container the helper operates on by default

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

Parameters:string|NavigationAbstractContainer – [optional] container to operate on. Default is null, meaning container will be reset.
Return type:AbstractHelper fluent interface, returns self

1236.1.1.4. getContainer

getContainer()

Returns the navigation container helper operates on by default

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

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

Return type:NavigationAbstractContainer navigation container

1236.1.1.5. parseContainer

parseContainer()

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

Parameters:NavigationAbstractContainer|string|null
Throws ExceptionInvalidArgumentException:
 

1236.1.1.6. setMinDepth

setMinDepth()

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

Parameters:int – [optional] minimum depth. Default is null, which sets no minimum depth.
Return type:AbstractHelper fluent interface, returns self

1236.1.1.7. getMinDepth

getMinDepth()

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

Return type:int|null minimum depth or null

1236.1.1.8. setMaxDepth

setMaxDepth()

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

Parameters:int – [optional] maximum depth. Default is null, which sets no maximum depth.
Return type:AbstractHelper fluent interface, returns self

1236.1.1.9. getMaxDepth

getMaxDepth()

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

Return type:int|null maximum depth or null

1236.1.1.10. setIndent

setIndent()

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

Parameters:string|int – indentation string or number of spaces
Return type:AbstractHelper fluent interface, returns self

1236.1.1.11. getIndent

getIndent()

Returns indentation

Return type:string

1236.1.1.12. setAcl

setAcl()

Sets ACL to use when iterating pages

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

Parameters:AclAclInterface – [optional] ACL object. Default is null.
Return type:AbstractHelper fluent interface, returns self

1236.1.1.13. getAcl

getAcl()

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

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

Return type:AclAclInterface|null ACL object or null

1236.1.1.14. setRole

setRole()

Sets ACL role(s) to use when iterating pages

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

Parameters:mixed – [optional] role to set. Expects a string, an instance of type {@link AclRoleRoleInterface}, or null. Default is null, which will set no role.
Return type:AbstractHelper fluent interface, returns self
Throws :ExceptionInvalidArgumentException if $role is invalid

1236.1.1.15. getRole

getRole()

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

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

Return type:string|AclRoleRoleInterface|null role or null

1236.1.1.16. setUseAcl

setUseAcl()

Sets whether ACL should be used

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

Parameters:bool – [optional] whether ACL should be used. Default is true.
Return type:AbstractHelper fluent interface, returns self

1236.1.1.17. getUseAcl

getUseAcl()

Returns whether ACL should be used

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

Return type:bool whether ACL should be used

1236.1.1.18. getRenderInvisible

getRenderInvisible()

Return renderInvisible flag

Return type:bool

1236.1.1.19. setRenderInvisible

setRenderInvisible()

Render invisible items?

Parameters:bool – [optional] boolean flag
Return type:AbstractHelper fluent interface returns self

1236.1.1.20. __call

__call()

Magic overload: Proxy calls to the navigation container

Parameters:
  • string – method name in container
  • array – [optional] arguments to pass
Return type:

mixed returns what the container returns

Throws :

NavigationExceptionExceptionInterface if method does not exist in container

1236.1.1.21. __toString

__toString()

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

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

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

Return type:string

1236.1.1.22. findActive

findActive()

Finds the deepest active page in the given container

Parameters:
  • NavigationAbstractContainer – container to search
  • 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.
  • int|null – [optional] maximum depth a page can have to be valid. Default is to use {@link getMaxDepth()}. A null value means no maximum depth required.
Return type:

array an associative array with the values ‘depth’ and ‘page’, or an empty array if not found

1236.1.1.23. hasContainer

hasContainer()

Checks if the helper has a container

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

Return type:bool whether the helper has a container or not

1236.1.1.24. hasAcl

hasAcl()

Checks if the helper has an ACL instance

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

Return type:bool whether the helper has a an ACL instance or not

1236.1.1.25. hasRole

hasRole()

Checks if the helper has an ACL role

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

Return type:bool whether the helper has a an ACL role or not

1236.1.1.26. htmlify

htmlify()

Returns an HTML string containing an ‘a’ element for the given page

Parameters:AbstractPage – page to generate HTML for
Return type:string HTML string for the given page

1236.1.1.27. setTranslator

setTranslator()

Sets translator to use in helper

Parameters:
  • Translator – [optional] translator. Default is null, which sets no translator.
  • string – [optional] text domain Default is null, which skips setTranslatorTextDomain
Return type:

AbstractHelper

1236.1.1.28. getTranslator

getTranslator()

Returns translator used in helper

Return type:Translator|null

1236.1.1.29. hasTranslator

hasTranslator()

Checks if the helper has a translator

Return type:bool

1236.1.1.30. setTranslatorEnabled

setTranslatorEnabled()

Sets whether translator is enabled and should be used

Parameters:bool – [optional] whether translator should be used. Default is true.
Return type:AbstractHelper

1236.1.1.31. isTranslatorEnabled

isTranslatorEnabled()

Returns whether translator is enabled and should be used

Return type:bool

1236.1.1.32. setTranslatorTextDomain

setTranslatorTextDomain()

Set translation text domain

Parameters:string
Return type:AbstractHelper

1236.1.1.33. getTranslatorTextDomain

getTranslatorTextDomain()

Return the translation text domain

Return type:string

1236.1.1.34. accept

accept()

Determines whether a page should be accepted when iterating

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:
  • AbstractPage – page to check
  • bool – [optional] if true, page will not be accepted if it is the descendant of a page that is not accepted. Default is true.
Return type:

bool whether page should be accepted

1236.1.1.35. acceptAcl

acceptAcl()

Determines whether a page should be accepted by ACL when iterating

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:AbstractPage – page to check
Return type:bool whether page is accepted by ACL

1236.1.1.36. getWhitespace

getWhitespace()

Retrieve whitespace representation of $indent

Parameters:int|string
Return type:string

1236.1.1.37. htmlAttribs

htmlAttribs()

Converts an associative array to a string of tag attributes.

Overloads {@link ViewHelperAbstractHtmlElement::htmlAttribs()}.

Parameters:array – an array where each key-value pair is converted to an attribute name and value
Return type:string an attribute string

1236.1.1.38. normalizeId

normalizeId()

Normalize an ID

Overrides {@link ViewHelperAbstractHtmlElement::normalizeId()}.

Parameters:string
Return type:string

1236.1.1.39. setDefaultAcl

setDefaultAcl()

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

Parameters:AclAclInterface – [optional] ACL object. Default is null, which sets no ACL object.
Return type:void

1236.1.1.40. setDefaultRole

setDefaultRole()

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

Parameters:mixed – [optional] role to set. Expects null, string, or an instance of {@link AclRoleRoleInterface}. Default is null, which sets no default role.
Return type:void
Throws :ExceptionInvalidArgumentException if role is invalid