Browse Source

added option to make bootstrap navbar 100% with

fixes #1474
tags/2.0.0-beta
Carsten Brandt 11 years ago
parent
commit
b7e5ed3b2d
  1. 13
      extensions/yii/bootstrap/NavBar.php

13
extensions/yii/bootstrap/NavBar.php

@ -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);
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');
if ($this->padded) {
echo Html::endTag('div');
}
echo Html::endTag('nav');
BootstrapPluginAsset::register($this->getView());
}

Loading…
Cancel
Save