Class TbBaseMenu
CMenu displays a multi-level menu using nested HTML lists.
The main property of CMenu is CMenu::$items
, which specifies the possible
items in the menu. A menu item has three main properties: visible, active and
items. The "visible" property specifies whether the menu item is currently
visible. The "active" property specifies whether the menu item is currently
selected. And the "items" property specifies the child menu items.
The following example shows how to use CMenu:
$this->widget('zii.widgets.CMenu', array( 'items'=>array( // Important: you need to specify url as 'controller/action', // not just as 'controller' even if default acion is used. array('label'=>'Home', 'url'=>array('site/index')), // 'Products' menu item will be selected no matter which tag parameter value is since it's not specified. array('label'=>'Products', 'url'=>array('product/index'), 'items'=>array( array('label'=>'New Arrivals', 'url'=>array('product/new', 'tag'=>'new')), array('label'=>'Most Popular', 'url'=>array('product/index', 'tag'=>'popular')), )), array('label'=>'Login', 'url'=>array('site/login'), 'visible'=>Yii::app()->user->isGuest), ), ));
- CComponent
-
CBaseController
-
CWidget
-
CMenu
-
TbBaseMenu
Direct known subclasses
Package: zii\widgets
Copyright: Copyright © Christoffer Niska 2012-
License: New BSD License
Author: Jonah Turnquist <poppitypop@gmail.com>
Author: Qiang Xue <qiang.xue@gmail.com>
Version: $Id$
Since: 1.1
Located at crisu83/yii-bootstrap/widgets/TbBaseMenu.php
Methods summary
abstract public
string
|
|
abstract public
string
|
|
abstract public
boolean
|
|
protected
|
|
protected
string
|
#
renderMenuItem( array $item )
Renders the content of a menu item. Note that the container and the sub-menus are not rendered here. |
protected
array
|
#
normalizeItems( array $items, string $route, boolean & $active )
Normalizes the |
Methods inherited from CMenu
init()
,
isItemActive()
,
renderMenuRecursive()
,
run()
Methods inherited from CWidget
__construct()
,
actions()
,
getController()
,
getId()
,
getOwner()
,
getViewFile()
,
getViewPath()
,
render()
,
setId()
Methods inherited from CBaseController
beginCache()
,
beginClip()
,
beginContent()
,
beginWidget()
,
createWidget()
,
endCache()
,
endClip()
,
endContent()
,
endWidget()
,
renderFile()
,
renderInternal()
,
widget()
Methods inherited from CComponent
__call()
,
__get()
,
__isset()
,
__set()
,
__unset()
,
asa()
,
attachBehavior()
,
attachBehaviors()
,
attachEventHandler()
,
canGetProperty()
,
canSetProperty()
,
detachBehavior()
,
detachBehaviors()
,
detachEventHandler()
,
disableBehavior()
,
disableBehaviors()
,
enableBehavior()
,
enableBehaviors()
,
evaluateExpression()
,
getEventHandlers()
,
hasEvent()
,
hasEventHandler()
,
hasProperty()
,
raiseEvent()
Magic methods summary
Properties summary
Properties inherited from CMenu
$activateItems
,
$activateParents
,
$activeCssClass
,
$encodeLabel
,
$firstItemCssClass
,
$hideEmptyItems
,
$htmlOptions
,
$itemCssClass
,
$itemTemplate
,
$items
,
$lastItemCssClass
,
$linkLabelWrapper
,
$submenuHtmlOptions
Properties inherited from CWidget
$actionPrefix
,
$skin
Magic properties inherited from CWidget
$controller
,
$id
,
$owner
,
$viewPath