Zend Framework
3.0
|
Helper for rendering menus from navigation containers. More...
Public Member Functions | |
__invoke ($container=null) | |
View helper entry point. | |
render ($container=null) | |
Renders menu. | |
renderMenu ($container=null, array $options=[]) | |
Renders helper. | |
renderPartial ($container=null, $partial=null) | |
Renders the given $container by invoking the partial view helper. | |
renderPartialWithParams (array $params=[], $container=null, $partial=null) | |
Renders the given $container by invoking the partial view helper with the given parameters as the model. | |
renderSubMenu (AbstractContainer $container=null, $ulClass=null, $indent=null, $liActiveClass=null) | |
Renders the inner-most sub menu for the active page in the $container. | |
escapeLabels ($flag=true) | |
Sets a flag indicating whether labels should be escaped. | |
setAddClassToListItem ($flag=true) | |
Enables/disables page class applied to element. | |
getAddClassToListItem () | |
Returns flag indicating whether page class should be applied to element. | |
setOnlyActiveBranch ($flag=true) | |
Sets a flag indicating whether only active branch should be rendered. | |
getOnlyActiveBranch () | |
Returns a flag indicating whether only active branch should be rendered. | |
setPartial ($partial) | |
Sets which partial view script to use for rendering menu. | |
getPartial () | |
Returns partial view script to use for rendering menu. | |
setRenderParents ($flag=true) | |
Enables/disables rendering of parents when only rendering active branch. | |
getRenderParents () | |
Returns flag indicating whether parents should be rendered when rendering only the active branch. | |
setUlClass ($ulClass) | |
Sets CSS class to use for the first 'ul' element when rendering. | |
getUlClass () | |
Returns CSS class to use for the first 'ul' element when rendering. | |
setLiActiveClass ($liActiveClass) | |
Sets CSS class to use for the active 'li' element when rendering. | |
getLiActiveClass () | |
Returns CSS class to use for the active 'li' element when rendering. | |
Public Member Functions inherited from AbstractHelper | |
__call ($method, array $arguments=[]) | |
Magic overload: Proxy calls to the navigation container. | |
__toString () | |
Magic overload: Proxy to render(). | |
accept (AbstractPage $page, $recursive=true) | |
Determines whether a page should be accepted when iterating. | |
setAcl (Acl\AclInterface $acl=null) | |
Sets ACL to use when iterating pages. | |
getAcl () | |
Returns ACL or null if it isn't set using setAcl() or setDefaultAcl(). | |
hasAcl () | |
Checks if the helper has an ACL instance. | |
setEventManager (EventManagerInterface $events) | |
Set the event manager. | |
getEventManager () | |
Get the event manager, if present. | |
setContainer ($container=null) | |
Sets navigation container the helper operates on by default. | |
getContainer () | |
Returns the navigation container helper operates on by default. | |
hasContainer () | |
Checks if the helper has a container. | |
setIndent ($indent) | |
Set the indentation string for using in render(), optionally a number of spaces to indent with. | |
getIndent () | |
Returns indentation. | |
setMaxDepth ($maxDepth=null) | |
Sets the maximum depth a page can have to be included when rendering. | |
getMaxDepth () | |
Returns maximum depth a page can have to be included when rendering. | |
setMinDepth ($minDepth=null) | |
Sets the minimum depth a page must have to be included when rendering. | |
getMinDepth () | |
Returns minimum depth a page must have to be included when rendering. | |
setRenderInvisible ($renderInvisible=true) | |
Render invisible items? | |
getRenderInvisible () | |
Return renderInvisible flag. | |
setRole ($role=null) | |
Sets ACL role(s) to use when iterating pages. | |
getRole () | |
Returns ACL role to use when iterating pages, or null if it isn't set using setRole() or setDefaultRole(). | |
hasRole () | |
Checks if the helper has an ACL role. | |
setServiceLocator (ContainerInterface $serviceLocator) | |
Set the service locator. | |
getServiceLocator () | |
Get the service locator. | |
setUseAcl ($useAcl=true) | |
Sets whether ACL should be used. | |
getUseAcl () | |
Returns whether ACL should be used. | |
Public Member Functions inherited from AbstractHtmlElement | |
getClosingBracket () | |
Get the tag closing bracket. | |
Public Member Functions inherited from AbstractHelper | |
setView (Renderer $view) | |
Set the View object. | |
getView () | |
Get the view object. | |
Protected Member Functions | |
renderDeepestMenu (AbstractContainer $container, $ulClass, $indent, $minDepth, $maxDepth, $escapeLabels, $addClassToListItem, $liActiveClass) | |
Renders the deepest active menu within [$minDepth, $maxDepth], (called from renderMenu()). | |
renderNormalMenu (AbstractContainer $container, $ulClass, $indent, $minDepth, $maxDepth, $onlyActive, $escapeLabels, $addClassToListItem, $liActiveClass) | |
Renders a normal menu (called from renderMenu()). | |
normalizeOptions (array $options=[]) | |
Normalizes given render options. | |
Protected Member Functions inherited from AbstractHelper | |
parseContainer (&$container=null) | |
Verifies container and eventually fetches it from service locator if it is a string. | |
isAllowed ($params) | |
Determines whether a page should be allowed given certain parameters. | |
getWhitespace ($indent) | |
Retrieve whitespace representation of $indent. | |
htmlAttribs ($attribs) | |
Converts an associative array to a string of tag attributes. | |
translate ($message, $textDomain=null) | |
Translate a message (for label, title, …) | |
normalizeId ($value) | |
Normalize an ID. | |
setDefaultListeners () | |
Attaches default ACL listeners, if ACLs are in use. | |
Protected Member Functions inherited from AbstractHtmlElement | |
isXhtml () | |
Is doctype XHTML? | |
htmlAttribs ($attribs) | |
Converts an associative array to a string of tag attributes. | |
normalizeId ($value) | |
Normalize an ID. | |
Protected Attributes | |
$addClassToListItem = false | |
$escapeLabels = true | |
$onlyActiveBranch = false | |
$partial = null | |
$renderParents = true | |
$ulClass = 'navigation' | |
$liActiveClass = 'active' | |
Protected Attributes inherited from AbstractHelper | |
$events | |
$container | |
$minDepth | |
$maxDepth | |
$indent = '' | |
$acl | |
$renderInvisible = false | |
$role | |
$serviceLocator | |
$useAcl = true | |
Protected Attributes inherited from AbstractHtmlElement | |
$closingBracket = null | |
Protected Attributes inherited from AbstractHelper | |
$view = null | |
Additional Inherited Members | |
Static Public Member Functions inherited from AbstractHelper | |
static | setDefaultAcl (Acl\AclInterface $acl=null) |
Sets default ACL to use if another ACL is not explicitly set. | |
static | setDefaultRole ($role=null) |
Sets default ACL role(s) to use when iterating pages if not explicitly set later with setRole(). | |
Public Attributes inherited from AbstractHtmlElement | |
const | EOL = PHP_EOL |
EOL character. | |
Static Protected Attributes inherited from AbstractHelper | |
static | $defaultAcl |
static | $defaultRole |
Helper for rendering menus from navigation containers.
__invoke | ( | $container = null | ) |
View helper entry point.
Retrieves helper and optionally sets container to operate on.
AbstractContainer | $container | [optional] container to operate on |
escapeLabels | ( | $flag = true | ) |
Sets a flag indicating whether labels should be escaped.
bool | $flag | [optional] escape labels |
getAddClassToListItem | ( | ) |
Returns flag indicating whether page class should be applied to element.
By default, this value is false.
getLiActiveClass | ( | ) |
Returns CSS class to use for the active 'li' element when rendering.
getOnlyActiveBranch | ( | ) |
Returns a flag indicating whether only active branch should be rendered.
By default, this value is false, meaning the entire menu will be be rendered.
getPartial | ( | ) |
Returns partial view script to use for rendering menu.
getRenderParents | ( | ) |
Returns flag indicating whether parents should be rendered when rendering only the active branch.
By default, this value is true.
getUlClass | ( | ) |
Returns CSS class to use for the first 'ul' element when rendering.
|
protected |
Normalizes given render options.
array | $options | [optional] options to normalize |
render | ( | $container = null | ) |
Renders menu.
Implements HelperInterface::render().
If a partial view is registered in the helper, the menu will be rendered using the given partial script. If no partial is registered, the menu will be rendered as an 'ul' element by the helper's internal method.
AbstractContainer | $container | [optional] container to render. Default is to render the container registered in the helper. |
Implements HelperInterface.
|
protected |
Renders the deepest active menu within [$minDepth, $maxDepth], (called from renderMenu()).
AbstractContainer | $container | container to render |
string | $ulClass | CSS class for first UL |
string | $indent | initial indentation |
int | null | $minDepth | minimum depth |
int | null | $maxDepth | maximum depth |
bool | $escapeLabels | Whether or not to escape the labels |
bool | $addClassToListItem | Whether or not page class applied to element |
string | $liActiveClass | CSS class for active LI |
renderMenu | ( | $container = null , |
|
array | $options = [] |
||
) |
Renders helper.
Renders a HTML 'ul' for the given $container. If $container is not given, the container registered in the helper will be used.
Available $options:
AbstractContainer | $container | [optional] container to create menu from. Default is to use the container retrieved from getContainer(). |
array | $options | [optional] options for controlling rendering |
|
protected |
Renders a normal menu (called from renderMenu()).
AbstractContainer | $container | container to render |
string | $ulClass | CSS class for first UL |
string | $indent | initial indentation |
int | null | $minDepth | minimum depth |
int | null | $maxDepth | maximum depth |
bool | $onlyActive | render only active branch? |
bool | $escapeLabels | Whether or not to escape the labels |
bool | $addClassToListItem | Whether or not page class applied to element |
string | $liActiveClass | CSS class for active LI |
renderPartial | ( | $container = null , |
|
$partial = null |
|||
) |
Renders the given $container by invoking the partial view helper.
The container will simply be passed on as a model to the view script as-is, and will be available in the partial script as 'container', e.g. echo 'Number of pages: ', count($this->container);
.
null | AbstractContainer | $container | [optional] container to pass to view script. Default is to use the container registered in the helper. |
null | string | array | $partial | [optional] partial view script to use. Default is to use the partial registered in the helper. If an array is given, it is expected to contain two values; the partial view script to use, and the module where the script can be found. |
Exception\RuntimeException | if no partial provided |
Exception\InvalidArgumentException | if partial is invalid array |
renderPartialWithParams | ( | array | $params = [] , |
$container = null , |
|||
$partial = null |
|||
) |
Renders the given $container by invoking the partial view helper with the given parameters as the model.
The container will simply be passed on as a model to the view script as-is, and will be available in the partial script as 'container', e.g. echo 'Number of pages: ', count($this->container);
.
Any parameters provided will be passed to the partial via the view model.
null | AbstractContainer | $container | [optional] container to pass to view script. Default is to use the container registered in the helper. |
null | string | array | $partial | [optional] partial view script to use. Default is to use the partial registered in the helper. If an array is given, it is expected to contain two values; the partial view script to use, and the module where the script can be found. |
Exception\RuntimeException | if no partial provided |
Exception\InvalidArgumentException | if partial is invalid array |
renderSubMenu | ( | AbstractContainer | $container = null , |
$ulClass = null , |
|||
$indent = null , |
|||
$liActiveClass = null |
|||
) |
Renders the inner-most sub menu for the active page in the $container.
This is a convenience method which is equivalent to the following call: renderMenu($container, array( 'indent' => $indent, 'ulClass' => $ulClass, 'minDepth' => null, 'maxDepth' => null, 'onlyActiveBranch' => true, 'renderParents' => false, 'liActiveClass' => $liActiveClass ));
AbstractContainer | $container | [optional] container to render. Default is to render the container registered in the helper. |
string | $ulClass | [optional] CSS class to use for UL element. Default is to use the value from getUlClass(). |
string | int | $indent | [optional] indentation as a string or number of spaces. Default is to use the value retrieved from getIndent(). |
string | $liActiveClass | [optional] CSS class to use for UL element. Default is to use the value from getUlClass(). |
setAddClassToListItem | ( | $flag = true | ) |
Enables/disables page class applied to element.
bool | $flag | [optional] page class applied to element Default is true. |
setLiActiveClass | ( | $liActiveClass | ) |
Sets CSS class to use for the active 'li' element when rendering.
string | $liActiveClass | CSS class to set |
setOnlyActiveBranch | ( | $flag = true | ) |
Sets a flag indicating whether only active branch should be rendered.
bool | $flag | [optional] render only active branch. |
setPartial | ( | $partial | ) |
Sets which partial view script to use for rendering menu.
string | array | $partial | partial view script or null. If an array is given, it is expected to contain two values; the partial view script to use, and the module where the script can be found. |
setRenderParents | ( | $flag = true | ) |
Enables/disables rendering of parents when only rendering active branch.
See setOnlyActiveBranch() for more information.
bool | $flag | [optional] render parents when rendering active branch. |
setUlClass | ( | $ulClass | ) |
Sets CSS class to use for the first 'ul' element when rendering.
string | $ulClass | CSS class to set |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |