View/Helper/Navigation/Menu.php
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_View
- Subpackage
- Helper
- Version
- $Id$
\Zend_View_Helper_Navigation_Menu
- Parent(s)
- \Zend_View_Helper_Navigation_HelperAbstract < \Zend_View_Helper_HtmlElement < \Zend_View_Helper_Abstract
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties
string $_activeClass = 'active'
'active'
Details- Type
- string
bool $_addPageClassToLi = false
false
Details- Type
- bool
bool $_expandSiblingNodesOfActiveBranch = false
false
Details- Type
- bool
bool $_onlyActiveBranch = false
false
Details- Type
- bool
string $_parentClass = 'menu-parent'
'menu-parent'
Details- Type
- string
string|array $_partial = null
null
Details- Type
- string | array
bool $_renderParentClass = false
false
Details- Type
- bool
bool $_renderParents = true
true
Details- Type
- bool
string $_ulClass = 'navigation'
'navigation'
Details- Type
- string
Methods
_normalizeOptions(array $options = array()) : array
Normalizes given render options
Name | Type | Description |
---|---|---|
$options | array | [optional] options to normalize |
Type | Description |
---|---|
array | normalized options |
_renderDeepestMenu(\Zend_Navigation_Container $container, string $ulClass, string $indent, string $innerIndent, int | null $minDepth, int | null $maxDepth, string | null $ulId, bool $addPageClassToLi, string | null $activeClass, string $parentClass, bool $renderParentClass) : string
Renders the deepest active menu within [$minDepth, $maxDeth], (called from {@link renderMenu()})
Name | Type | Description |
---|---|---|
$container | \Zend_Navigation_Container | container to render |
$ulClass | string | CSS class for first UL |
$indent | string | initial indentation |
$innerIndent | string | inner indentation |
$minDepth | int | null | minimum depth |
$maxDepth | int | null | maximum depth |
$ulId | string | null | unique identifier (id)
|
$addPageClassToLi | bool | adds CSS class from page to li element |
$activeClass | string | null | CSS class for active element |
$parentClass | string | CSS class for parent
|
$renderParentClass | bool | Render parent class? |
Type | Description |
---|---|
string | rendered menu (HTML) |
_renderMenu(\Zend_Navigation_Container $container, string $ulClass, string $indent, string $innerIndent, int | null $minDepth, int | null $maxDepth, bool $onlyActive, bool $expandSibs, string | null $ulId, bool $addPageClassToLi, string | null $activeClass, string $parentClass, bool $renderParentClass) : string
Renders a normal menu (called from {@link renderMenu()})
Name | Type | Description |
---|---|---|
$container | \Zend_Navigation_Container | container to render |
$ulClass | string | CSS class for first UL |
$indent | string | initial indentation |
$innerIndent | string | inner indentation |
$minDepth | int | null | minimum depth |
$maxDepth | int | null | maximum depth |
$onlyActive | bool | render only active branch? |
$expandSibs | bool | render siblings of active
|
$ulId | string | null | unique identifier (id)
|
$addPageClassToLi | bool | adds CSS class from page to li element |
$activeClass | string | null | CSS class for active element |
$parentClass | string | CSS class for parent
|
$renderParentClass | bool | Render parent class? |
Type | Description |
---|---|
string | rendered menu (HTML) |
addPageClassToLi(bool $flag = true) : \Zend_View_Helper_Navigation_Menu
Adds CSS class from page to li element
Name | Type | Description |
---|---|---|
$flag | bool | [optional] adds CSS class from
|
Type | Description |
---|---|
\Zend_View_Helper_Navigation_Menu | fluent interface, returns self |
getActiveClass() : string
Returns CSS class to use for the active elements when rendering
Type | Description |
---|---|
string | CSS class |
getAddPageClassToLi() : bool
Returns a flag indicating whether the CSS class from page to be added to li element
Type | Description |
---|---|
bool |
getExpandSiblingNodesOfActiveBranch() : bool
Returns a flag indicating whether to expand all sibling nodes of the active branch
Type | Description |
---|---|
bool | whether siblings of nodes in the active branch should be expanded |
getOnlyActiveBranch() : bool
Returns a flag indicating whether only active branch should be rendered
Type | Description |
---|---|
bool | whether only active branch should be rendered |
getParentClass() : string
Returns CSS class to use for the parent lie elements when rendering
Type | Description |
---|---|
string | CSS class |
getPartial() : string | array | null
Returns partial view script to use for rendering menu
Type | Description |
---|---|
string | array | null |
getRenderParentClass() : bool
Returns flag indicating whether parent class should be rendered to the li element
Type | Description |
---|---|
bool | whether parent class should be rendered |
getRenderParents() : bool
Returns flag indicating whether parents should be rendered when rendering only the active branch
Type | Description |
---|---|
bool | whether parents should be rendered |
getUlClass() : string
Returns CSS class to use for the first 'ul' element when rendering
Type | Description |
---|---|
string | CSS class |
getUlId() : string | null
Returns unique identifier (id) to use for the first 'ul' element when rendering
Type | Description |
---|---|
string | null | Unique identifier (id); Default is 'null' |
htmlify(\Zend_Navigation_Page $page) : string
Returns an HTML string containing an 'a' element for the given page if the page's href is not empty, and a 'span' element if it is empty
Name | Type | Description |
---|---|---|
$page | \Zend_Navigation_Page | page to generate HTML for |
Type | Description |
---|---|
string | HTML string for the given page |
menu(\Zend_Navigation_Container $container = null) : \Zend_View_Helper_Navigation_Menu
View helper entry point: Retrieves helper and optionally sets container to operate on
Name | Type | Description |
---|---|---|
$container | \Zend_Navigation_Container | [optional] container to
|
Type | Description |
---|---|
\Zend_View_Helper_Navigation_Menu | fluent interface, returns self |
render(\Zend_Navigation_Container $container = null) : string
Renders menu
Name | Type | Description |
---|---|---|
$container | \Zend_Navigation_Container | [optional] container to
|
Type | Description |
---|---|
string | helper output |
renderMenu(\Zend_Navigation_Container $container = null, array $options = array()) : string
Renders helper
Name | Type | Description |
---|---|---|
$container | \Zend_Navigation_Container | [optional] container to
|
$options | array | [optional] options for
|
Type | Description |
---|---|
string | rendered menu |
renderPartial(\Zend_Navigation_Container $container = null, string | array $partial = null) : string
Renders the given $container by invoking the partial view helper
echo 'Number of pages: ', count($this->container);
.Name | Type | Description |
---|---|---|
$container | \Zend_Navigation_Container | [optional] container to
|
$partial | string | array | [optional] partial view
|
Type | Description |
---|---|
string | helper output |
Exception | Description |
---|---|
\Zend_View_Exception | When no partial script is set |
renderSubMenu(\Zend_Navigation_Container $container = null, string | null $ulClass = null, string | int $indent = null, string | null $ulId = null, bool $addPageClassToLi = false, string | int $innerIndent = null) : string
Renders the inner-most sub menu for the active page in the $container
renderMenu($container, array(
'indent' => $indent,
'ulClass' => $ulClass,
'minDepth' => null,
'maxDepth' => null,
'onlyActiveBranch' => true,
'renderParents' => false
));
Name | Type | Description |
---|---|---|
$container | \Zend_Navigation_Container | [optional] container to
|
$ulClass | string | null | [optional] CSS class to
|
$indent | string | int | [optional] indentation as
|
$ulId | string | null | [optional] Unique identifier
|
$addPageClassToLi | bool | adds CSS class from page to li element |
$innerIndent | string | int | [optional] inner
|
Type | Description |
---|---|
string | rendered content |
setActiveClass(string $activeClass) : \Zend_View_Helper_Navigation_Menu
Sets CSS class to use for the active elements when rendering
Name | Type | Description |
---|---|---|
$activeClass | string | CSS class to set |
Type | Description |
---|---|
\Zend_View_Helper_Navigation_Menu | fluent interface, returns self |
setExpandSiblingNodesOfActiveBranch(bool $flag = true) : \Zend_View_Helper_Navigation_Menu
Sets a flag indicating whether to expand all sibling nodes of the active branch
Name | Type | Description |
---|---|---|
$flag | bool | [optional] expand all siblings of
|
Type | Description |
---|---|
\Zend_View_Helper_Navigation_Menu | fluent interface, returns self |
setInnerIndent(string | int $indent) : \Zend_View_Helper_Navigation_HelperAbstract
Set the inner indentation string for using in {@link render()}, optionally a number of spaces to indent with
Name | Type | Description |
---|---|---|
$indent | string | int | indentation string or number of spaces |
Type | Description |
---|---|
\Zend_View_Helper_Navigation_HelperAbstract | fluent interface, returns self |
setOnlyActiveBranch(bool $flag = true) : \Zend_View_Helper_Navigation_Menu
Sets a flag indicating whether only active branch should be rendered
Name | Type | Description |
---|---|---|
$flag | bool | [optional] render only active
|
Type | Description |
---|---|
\Zend_View_Helper_Navigation_Menu | fluent interface, returns self |
setParentClass(string $parentClass) : \Zend_View_Helper_Navigation_Menu
Sets CSS class to use for the parent li elements when rendering
Name | Type | Description |
---|---|---|
$parentClass | string | CSS class to set to parents |
Type | Description |
---|---|
\Zend_View_Helper_Navigation_Menu | fluent interface, returns self |
setPartial(string | array $partial) : \Zend_View_Helper_Navigation_Menu
Sets which partial view script to use for rendering menu
Name | Type | Description |
---|---|---|
$partial | string | array | 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. |
Type | Description |
---|---|
\Zend_View_Helper_Navigation_Menu | fluent interface, returns self |
setRenderParentClass(bool $flag = true) : \Zend_View_Helper_Navigation_Menu
Enables/disables rendering of parent class to the li element
Name | Type | Description |
---|---|---|
$flag | bool | [optional] render with parent
|
Type | Description |
---|---|
\Zend_View_Helper_Navigation_Menu | fluent interface, returns self |
setRenderParents(bool $flag = true) : \Zend_View_Helper_Navigation_Menu
Enables/disables rendering of parents when only rendering active branch
Name | Type | Description |
---|---|---|
$flag | bool | [optional] render parents when
|
Type | Description |
---|---|
\Zend_View_Helper_Navigation_Menu | fluent interface, returns self |
setUlClass(string $ulClass) : \Zend_View_Helper_Navigation_Menu
Sets CSS class to use for the first 'ul' element when rendering
Name | Type | Description |
---|---|---|
$ulClass | string | CSS class to set |
Type | Description |
---|---|
\Zend_View_Helper_Navigation_Menu | fluent interface, returns self |
setUlId(string | null $ulId) : \Zend_View_Helper_Navigation_Menu
Sets unique identifier (id) to use for the first 'ul' element when rendering
Name | Type | Description |
---|---|---|
$ulId | string | null | Unique identifier (id) to set |
Type | Description |
---|---|
\Zend_View_Helper_Navigation_Menu | fluent interface, returns self |