Public Member Functions | Protected Member Functions | Protected Attributes

Zend_View_Helper_Navigation_Menu Class Reference

Inheritance diagram for Zend_View_Helper_Navigation_Menu:
Zend_View_Helper_Navigation_HelperAbstract Zend_View_Helper_HtmlElement Zend_View_Helper_Navigation_Helper Zend_View_Helper_Abstract Zend_View_Helper_Interface

Public Member Functions

 menu (Zend_Navigation_Container $container=null)
 setUlClass ($ulClass)
 getUlClass ()
 setOnlyActiveBranch ($flag=true)
 getOnlyActiveBranch ()
 setRenderParents ($flag=true)
 getRenderParents ()
 setPartial ($partial)
 getPartial ()
 htmlify (Zend_Navigation_Page $page)
 renderMenu (Zend_Navigation_Container $container=null, array $options=array())
 renderSubMenu (Zend_Navigation_Container $container=null, $ulClass=null, $indent=null)
 renderPartial (Zend_Navigation_Container $container=null, $partial=null)
 render (Zend_Navigation_Container $container=null)

Protected Member Functions

 _normalizeOptions (array $options=array())
 _renderDeepestMenu (Zend_Navigation_Container $container, $ulClass, $indent, $minDepth, $maxDepth)
 _renderMenu (Zend_Navigation_Container $container, $ulClass, $indent, $minDepth, $maxDepth, $onlyActive)

Protected Attributes

 $_ulClass = 'navigation'
 $_onlyActiveBranch = false
 $_renderParents = true
 $_partial = null

Detailed Description

Definition at line 37 of file Menu.php.


Member Function Documentation

_normalizeOptions ( array $  options = array() ) [protected]

Normalizes given render options

Parameters:
array$options[optional] options to normalize
Returns:
array normalized options

Definition at line 252 of file Menu.php.

_renderDeepestMenu ( Zend_Navigation_Container $  container,
ulClass,
indent,
minDepth,
maxDepth 
) [protected]

Renders the deepest active menu within [$minDepth, $maxDeth], (called from renderMenu())

Parameters:
Zend_Navigation_Container$containercontainer to render
array$activeactive page and depth
string$ulClassCSS class for first UL
string$indentinitial indentation
int | null$minDepthminimum depth
int | null$maxDepthmaximum depth
Returns:
string rendered menu

Definition at line 311 of file Menu.php.

_renderMenu ( Zend_Navigation_Container $  container,
ulClass,
indent,
minDepth,
maxDepth,
onlyActive 
) [protected]

Renders a normal menu (called from renderMenu())

Parameters:
Zend_Navigation_Container$containercontainer to render
string$ulClassCSS class for first UL
string$indentinitial indentation
int | null$minDepthminimum depth
int | null$maxDepthmaximum depth
bool$onlyActiverender only active branch?
Returns:
string

Definition at line 363 of file Menu.php.

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.

Returns:
bool whether only active branch should be rendered

Definition at line 134 of file Menu.php.

getPartial (  )

Returns partial view script to use for rendering menu

Returns:
string|array|null

Definition at line 193 of file Menu.php.

getRenderParents (  )

Returns flag indicating whether parents should be rendered when rendering only the active branch

By default, this value is true.

Returns:
bool whether parents should be rendered

Definition at line 163 of file Menu.php.

getUlClass (  )

Returns CSS class to use for the first 'ul' element when rendering

Returns:
string CSS class

Definition at line 108 of file Menu.php.

htmlify ( Zend_Navigation_Page $  page )

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 Zend_View_Helper_Navigation_Abstract::htmlify().

Parameters:
Zend_Navigation_Page$pagepage to generate HTML for
Returns:
string HTML string for the given page

Reimplemented from Zend_View_Helper_Navigation_HelperAbstract.

Definition at line 209 of file Menu.php.

menu ( Zend_Navigation_Container $  container = null )

View helper entry point: Retrieves helper and optionally sets container to operate on

Parameters:
Zend_Navigation_Container$container[optional] container to operate on
Returns:
Zend_View_Helper_Navigation_Menu fluent interface, returns self

Definition at line 77 of file Menu.php.

render ( Zend_Navigation_Container $  container = null )

Renders menu

Implements 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.

See also:
renderPartial()
renderMenu()
Parameters:
Zend_Navigation_Container$container[optional] container to render. Default is to render the container registered in the helper.
Returns:
string helper output

Implements Zend_View_Helper_Navigation_Helper.

Definition at line 633 of file Menu.php.

renderMenu ( Zend_Navigation_Container $  container = null,
array $  options = array() 
)

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:

Parameters:
Zend_Navigation_Container$container[optional] container to create menu from. Default is to use the container retrieved from getContainer().
array$options[optional] options for controlling rendering
Returns:
string rendered menu

Definition at line 484 of file Menu.php.

renderPartial ( Zend_Navigation_Container $  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);.

Parameters:
Zend_Navigation_Container$container[optional] container to pass to view script. Default is to use the container registered in the helper.
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.
Returns:
string helper output

Definition at line 577 of file Menu.php.

renderSubMenu ( Zend_Navigation_Container $  container = null,
ulClass = null,
indent = 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 ));

Parameters:
Zend_Navigation_Container$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().
Returns:
string rendered content

Definition at line 541 of file Menu.php.

setOnlyActiveBranch ( flag = true )

Sets a flag indicating whether only active branch should be rendered

Parameters:
bool$flag[optional] render only active branch. Default is true.
Returns:
Zend_View_Helper_Navigation_Menu fluent interface, returns self

Definition at line 120 of file Menu.php.

setPartial ( partial )

Sets which partial view script to use for rendering menu

Parameters:
string | array$partialpartial 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.
Returns:
Zend_View_Helper_Navigation_Menu fluent interface, returns self

Definition at line 179 of file Menu.php.

setRenderParents ( flag = true )

Enables/disables rendering of parents when only rendering active branch

See setOnlyActiveBranch() for more information.

Parameters:
bool$flag[optional] render parents when rendering active branch. Default is true.
Returns:
Zend_View_Helper_Navigation_Menu fluent interface, returns self

Definition at line 149 of file Menu.php.

setUlClass ( ulClass )

Sets CSS class to use for the first 'ul' element when rendering

Parameters:
string$ulClassCSS class to set
Returns:
Zend_View_Helper_Navigation_Menu fluent interface, returns self

Definition at line 94 of file Menu.php.


The documentation for this class was generated from the following file: