API Documentation

View/Helper/Navigation/Menu.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_View
subpackage
Helper
version
$Id: Menu.php 20096 2010-01-06 02:05:09Z bkarwin $
Classes
Zend_View_Helper_Navigation_Menu

Description

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.

Zend_View_Helper_Navigation_Menu

Extends from
Zend_View_Helper_Navigation_HelperAbstract
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_View
subpackage
Helper
Properties
$_ulClass
$_onlyActiveBranch
$_renderParents
$_partial
Methods
menu
setUlClass
getUlClass
setOnlyActiveBranch
getOnlyActiveBranch
setRenderParents
getRenderParents
setPartial
getPartial
htmlify
_normalizeOptions
_renderDeepestMenu
_renderMenu
renderMenu
renderSubMenu
renderPartial
render

Description

Helper for rendering menus from navigation containers

Properties

$_onlyActiveBranch

bool $_onlyActiveBranch = 'false'

Whether only active branch should be rendered

Details

$_onlyActiveBranch
bool
visibility
protected
default
false
final
false
static
false

$_partial

string|array $_partial = 'null'

Partial view script to use for rendering menu

Details

$_partial
string|array
visibility
protected
default
null
final
false
static
false

$_renderParents

bool $_renderParents = 'true'

Whether parents should be rendered when only rendering active branch

Details

$_renderParents
bool
visibility
protected
default
true
final
false
static
false

$_ulClass

string $_ulClass = 'navigation'

CSS class to use for the ul element

Details

$_ulClass
string
visibility
protected
default
navigation
final
false
static
false

Methods

_normalizeOptions

_normalizeOptions( array $options = array ) : array

Normalizes given render options

Arguments
$options
array
[optional] options to normalize
Output
array
normalized options
Details
visibility
protected
final
false
static
false

_renderDeepestMenu

_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()})

Arguments
$container
Zend_Navigation_Container
container to render
$ulClass
string
CSS class for first UL
$indent
string
initial indentation
$minDepth
intnull
minimum depth
$maxDepth
intnull
maximum depth
Output
string
rendered menu
Details
visibility
protected
final
false
static
false

_renderMenu

_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()})

Arguments
$container
Zend_Navigation_Container
container to render
$ulClass
string
CSS class for first UL
$indent
string
initial indentation
$minDepth
intnull
minimum depth
$maxDepth
intnull
maximum depth
$onlyActive
bool
render only active branch?
Output
string
Details
visibility
protected
final
false
static
false

getOnlyActiveBranch

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.

Output
bool
whether only active branch should be rendered
Details
visibility
public
final
false
static
false

getPartial

getPartial( ) : string|array|null

Returns partial view script to use for rendering menu

Output
string|array|null
Details
visibility
public
final
false
static
false

getRenderParents

getRenderParents( ) : bool

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

By default, this value is true.

Output
bool
whether parents should be rendered
Details
visibility
public
final
false
static
false

getUlClass

getUlClass( ) : string

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

Output
string
CSS class
Details
visibility
public
final
false
static
false

htmlify

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()}.

Arguments
$page
Zend_Navigation_Page
page to generate HTML for
Output
string
HTML string for the given page
Details
visibility
public
final
false
static
false

menu

menu( Zend_Navigation_Container $container = null ) : Zend_View_Helper_Navigation_Menu

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

Arguments
$container
Zend_Navigation_Container
[optional] container to operate on
Output
Zend_View_Helper_Navigation_Menu
fluent interface, returns self
Details
visibility
public
final
false
static
false

render

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.

Arguments
$container
Zend_Navigation_Container
[optional] container to render. Default is to render the container registered in the helper.
Output
string
helper output
Details
visibility
public
final
false
static
false
see
renderPartial()
see
renderMenu()

renderMenu

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:

Arguments
$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
Output
string
rendered menu
Details
visibility
public
final
false
static
false

renderPartial

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);.

Arguments
$container
Zend_Navigation_Container
[optional] container to pass to view script. Default is to use the container registered in the helper.
$partial
stringarray
[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.
Output
string
helper output
Details
visibility
public
final
false
static
false

renderSubMenu

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 ));

Arguments
$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
stringint
[optional] indentation as a string or number of spaces. Default is to use the value retrieved from {@link getIndent()}.
Output
string
rendered content
Details
visibility
public
final
false
static
false

setOnlyActiveBranch

setOnlyActiveBranch( bool $flag = true ) : Zend_View_Helper_Navigation_Menu

Sets a flag indicating whether only active branch should be rendered

Arguments
$flag
bool
[optional] render only active branch. Default is true.
Output
Zend_View_Helper_Navigation_Menu
fluent interface, returns self
Details
visibility
public
final
false
static
false

setPartial

setPartial( string|array $partial ) : Zend_View_Helper_Navigation_Menu

Sets which partial view script to use for rendering menu

Arguments
$partial
stringarray
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.
Output
Zend_View_Helper_Navigation_Menu
fluent interface, returns self
Details
visibility
public
final
false
static
false

setRenderParents

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.

Arguments
$flag
bool
[optional] render parents when rendering active branch. Default is true.
Output
Zend_View_Helper_Navigation_Menu
fluent interface, returns self
Details
visibility
public
final
false
static
false

setUlClass

setUlClass( string $ulClass ) : Zend_View_Helper_Navigation_Menu

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

Arguments
$ulClass
string
CSS class to set
Output
Zend_View_Helper_Navigation_Menu
fluent interface, returns self
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.