Commit b7e5ed3b by Carsten Brandt

added option to make bootstrap navbar 100% with

fixes #1474
parent 454174a6
......@@ -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());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment