Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Helper for rendering menus from navigation containers

bool
$_onlyActiveBranch= 'false'
Whether only active branch should be rendered
false
Details
string|array
$_partial= 'null'
Partial view script to use for rendering menu
null
Details
bool
$_renderParents= 'true'
Whether parents should be rendered when only rendering active branch
true
Details
_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, int|null $minDepth, int|null $maxDepth
)
:
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 |
$minDepth | int|null | minimum depth |
$maxDepth | int|null | maximum depth |
Type | Description |
---|---|
string | rendered menu |

_renderMenu(
\Zend_Navigation_Container $container, string $ulClass, string $indent, int|null $minDepth, int|null $maxDepth, bool $onlyActive
)
:
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 |
$minDepth | int|null | minimum depth |
$maxDepth | int|null | maximum depth |
$onlyActive | bool | render only active branch? |
Type | Description |
---|---|
string |

getOnlyActiveBranch(
)
:
bool
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.
Type | Description |
---|---|
bool | whether only active branch should be rendered |

getPartial(
)
:
string|array|null
Returns partial view script to use for rendering menu
Type | Description |
---|---|
string|array|null |

getRenderParents(
)
:
bool
Returns flag indicating whether parents should be rendered when rendering only the active branch
By default, this value is true.
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 |

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
Overrides {@link Zend_View_Helper_Navigation_Abstract::htmlify()}.
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 operate on |
Type | Description |
---|---|
\Zend_View_Helper_Navigation_Menu | fluent interface, returns self |

render(
\Zend_Navigation_Container $container
=
null
)
:
string
Renders menu
Implements {@link Zend_View_Helper_Navigation_Helper::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.
Name | Type | Description |
---|---|---|
$container | \Zend_Navigation_Container | [optional] container to render. Default is to render the container registered in the helper. |
Type | Description |
---|---|
string | helper output |

renderMenu(
\Zend_Navigation_Container $container
=
null, array $options
=
array()
)
:
string
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:
Name | Type | Description |
---|---|---|
$container | \Zend_Navigation_Container | [optional] container to create menu from. Default is to use the container retrieved from {@link getContainer()}. |
$options | array | [optional] options for controlling rendering |
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
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);
.
Name | Type | Description |
---|---|---|
$container | \Zend_Navigation_Container | [optional] container to pass to view script. Default is to use the container registered in the helper. |
$partial | string|array | [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. |
Type | Description |
---|---|
string | helper output |

renderSubMenu(
\Zend_Navigation_Container $container
=
null, string $ulClass
=
null, string|int $indent
=
null
)
:
string
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
));
Name | Type | Description |
---|---|---|
$container | \Zend_Navigation_Container | [optional] container to render. Default is to render the container registered in the helper. |
$ulClass | string | [optional] CSS class to use for UL element. Default is to use the value from {@link getUlClass()}. |
$indent | string|int | [optional] indentation as a string or number of spaces. Default is to use the value retrieved from {@link getIndent()}. |
Type | Description |
---|---|
string | rendered content |

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 branch. Default is true. |
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 |

setRenderParents(
bool $flag
=
true
)
:
\Zend_View_Helper_Navigation_Menu
Enables/disables rendering of parents when only rendering active branch
See {@link setOnlyActiveBranch()} for more information.
Name | Type | Description |
---|---|---|
$flag | bool | [optional] render parents when rendering active branch. Default is true. |
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 |