PHP Class yii\apidoc\templates\bootstrap\SideNavWidget

For example: php echo Nav::widget([ 'items' => [ [ 'label' => 'Home', 'url' => ['site/index'], 'linkOptions' => [...], ], [ 'label' => 'Dropdown', 'items' => [ ['label' => 'Level 1 - Dropdown A', 'url' => '#'], '
  • ', '', ['label' => 'Level 1 - Dropdown B', 'url' => '#'], ], ], ], ]);
    Note: Multilevel dropdowns beyond Level 1 are not supported in Bootstrap 3.
    See also: http://getbootstrap.com/components.html#dropdowns
    See also: http://getbootstrap.com/components/#nav
    Since: 2.0
    Author: Antonio Ramirez ([email protected])
    Inheritance: extends yii\bootstrap\Widget
    Datei anzeigen Open project: yiisoft/yii2-apidoc Class Usage Examples

    Public Properties

    Property Type Description
    $activeUrl the route used to determine if a menu item is active or not. If not set, it will use the route of the current request.
    $encodeLabels whether the nav items labels should be HTML-encoded.
    $items list of items in the nav widget. Each array element represents a single menu item which can be either a string or an array with the following structure: - label: string, required, the nav item label. - url: optional, the item's URL. Defaults to "#". - visible: boolean, optional, whether this menu item is visible. Defaults to true. - linkOptions: array, optional, the HTML attributes of the item's link. - options: array, optional, the HTML attributes of the item container (LI). - active: boolean, optional, whether the item should be on active state or not. - items: array|string, optional, the configuration array for creating a [[Dropdown]] widget, or a string representing the dropdown menu. Note that Bootstrap does not support sub-dropdown menus. If a menu item is a string, it will be rendered directly without HTML encoding.

    Public Methods

    Method Description
    init ( ) Initializes the widget.
    renderItem ( string | array $item, boolean $collapsed = true ) : string Renders a widget's item.
    renderItems ( ) Renders widget items.
    run ( ) Renders the widget.

    Method Details

    init() public method

    Initializes the widget.
    public init ( )

    renderItem() public method

    Renders a widget's item.
    public renderItem ( string | array $item, boolean $collapsed = true ) : string
    $item string | array the item to render.
    $collapsed boolean whether to collapse item if not active
    return string the rendering result.

    renderItems() public method

    Renders widget items.
    public renderItems ( )

    run() public method

    Renders the widget.
    public run ( )

    Property Details

    $activeUrl public_oe property

    the route used to determine if a menu item is active or not. If not set, it will use the route of the current request.
    See also: params
    See also: isItemActive
    public $activeUrl

    $encodeLabels public_oe property

    whether the nav items labels should be HTML-encoded.
    public $encodeLabels

    $items public_oe property

    list of items in the nav widget. Each array element represents a single menu item which can be either a string or an array with the following structure: - label: string, required, the nav item label. - url: optional, the item's URL. Defaults to "#". - visible: boolean, optional, whether this menu item is visible. Defaults to true. - linkOptions: array, optional, the HTML attributes of the item's link. - options: array, optional, the HTML attributes of the item container (LI). - active: boolean, optional, whether the item should be on active state or not. - items: array|string, optional, the configuration array for creating a [[Dropdown]] widget, or a string representing the dropdown menu. Note that Bootstrap does not support sub-dropdown menus. If a menu item is a string, it will be rendered directly without HTML encoding.
    public $items