PHP Class yii\bootstrap\NavBar

Any content enclosed between the [[begin()]] and [[end()]] calls of NavBar is treated as the content of the navbar. You may use widgets such as Nav or Menu to build up such content. For example, php use yii\bootstrap\NavBar; use yii\bootstrap\Nav; NavBar::begin(['brandLabel' => 'NavBar Test']); echo Nav::widget([ 'items' => [ ['label' => 'Home', 'url' => ['/site/index']], ['label' => 'About', 'url' => ['/site/about']], ], 'options' => ['class' => 'navbar-nav'], ]); NavBar::end();
See also: http://getbootstrap.com/components/#navbar
Since: 2.0
Author: Antonio Ramirez ([email protected])
Author: Alexander Kochetov ([email protected])
Inheritance: extends yii\bootstrap\Widget
Show file Open project: yiisoft/yii2-bootstrap Class Usage Examples

Public Properties

Property Type Description
$brandLabel the text of the brand or false if it's not used. Note that this is not HTML-encoded.
$brandOptions the HTML attributes of the brand link.
$brandUrl array | string | boolean
$containerOptions the HTML attributes for the container tag. The following special options are recognized: - tag: string, defaults to "div", the name of the container tag.
$innerContainerOptions the HTML attributes of the inner container.
$options the HTML attributes for the widget container tag. The following special options are recognized: - tag: string, defaults to "nav", the name of the container tag.
$renderInnerContainer whether the navbar content should be included in an inner div container which by default adds left and right padding. Set this to false for a 100% width navbar.
$screenReaderToggleText text to show for screen readers for the button to toggle the navbar.

Public Methods

Method Description
init ( ) Initializes the widget.
run ( ) Renders the widget.

Protected Methods

Method Description
renderToggleButton ( ) : string Renders collapsible toggle button.

Method Details

init() public method

Initializes the widget.
public init ( )

renderToggleButton() protected method

Renders collapsible toggle button.
protected renderToggleButton ( ) : string
return string the rendering toggle button.

run() public method

Renders the widget.
public run ( )

Property Details

$brandLabel public property

the text of the brand or false if it's not used. Note that this is not HTML-encoded.
See also: http://getbootstrap.com/components/#navbar
public $brandLabel

$brandOptions public property

the HTML attributes of the brand link.
See also: yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
public $brandOptions

$brandUrl public property

public array|string|bool $brandUrl
return array | string | boolean

$containerOptions public property

the HTML attributes for the container tag. The following special options are recognized: - tag: string, defaults to "div", the name of the container tag.
See also: yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
public $containerOptions

$innerContainerOptions public property

the HTML attributes of the inner container.
See also: yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
public $innerContainerOptions

$options public property

the HTML attributes for the widget container tag. The following special options are recognized: - tag: string, defaults to "nav", the name of the container tag.
See also: yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
public $options

$renderInnerContainer public property

whether the navbar content should be included in an inner div container which by default adds left and right padding. Set this to false for a 100% width navbar.
public $renderInnerContainer

$screenReaderToggleText public property

text to show for screen readers for the button to toggle the navbar.
public $screenReaderToggleText