mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-23 04:00:23 +08:00
@ -50,8 +50,15 @@ class NavBar extends Widget
|
||||
* @var array the HTML attributes of the brand link.
|
||||
*/
|
||||
public $brandOptions = [];
|
||||
|
||||
/**
|
||||
* @var string text to show for screen readers for the button to toggle the navbar.
|
||||
*/
|
||||
public $screenReaderToggleText = 'Toggle navigation';
|
||||
/**
|
||||
* @var bool whether the navbar content should be included in a `container` div which adds left and right padding.
|
||||
* Set this to false for a 100% width navbar.
|
||||
*/
|
||||
public $padded = true;
|
||||
|
||||
/**
|
||||
* Initializes the widget.
|
||||
@ -67,7 +74,9 @@ class NavBar extends Widget
|
||||
}
|
||||
|
||||
echo Html::beginTag('nav', $this->options);
|
||||
echo Html::beginTag('div', ['class' => 'container']);
|
||||
if ($this->padded) {
|
||||
echo Html::beginTag('div', ['class' => 'container']);
|
||||
}
|
||||
|
||||
echo Html::beginTag('div', ['class' => 'navbar-header']);
|
||||
echo $this->renderToggleButton();
|
||||
@ -86,7 +95,9 @@ class NavBar extends Widget
|
||||
{
|
||||
|
||||
echo Html::endTag('div');
|
||||
echo Html::endTag('div');
|
||||
if ($this->padded) {
|
||||
echo Html::endTag('div');
|
||||
}
|
||||
echo Html::endTag('nav');
|
||||
BootstrapPluginAsset::register($this->getView());
|
||||
}
|
||||
|
Reference in New Issue
Block a user