Class hscstudio\heart\widgets\NavBar
Inheritance | hscstudio\heart\widgets\NavBar » yii\bootstrap\Widget |
---|---|
Available since version | 2.0 |
NavBar renders a navbar HTML component.
Any content enclosed between the \hscstudio\heart\widgets\begin() and \hscstudio\heart\widgets\end() calls of NavBar is treated as the content of the navbar. You may use widgets such as hscstudio\heart\widgets\Nav or \yii\widgets\Menu to build up such content. For example,
use yii\bootstrap\NavBar;
use yii\widgets\Menu;
NavBar::begin(['brandLabel' => 'NavBar Test']);
echo Nav::widget([
'items' => [
['label' => 'Home', 'url' => ['/site/index']],
['label' => 'About', 'url' => ['/site/about']],
],
]);
NavBar::end();
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$brandLabel | string | The text of the brand. | hscstudio\heart\widgets\NavBar |
$brandOptions | array | The HTML attributes of the brand link. | hscstudio\heart\widgets\NavBar |
$brandUrl | hscstudio\heart\widgets\NavBar | ||
$containerOptions | array | The HTML attributes for the container tag. | hscstudio\heart\widgets\NavBar |
$innerContainerOptions | array | The HTML attributes of the inner container. | hscstudio\heart\widgets\NavBar |
$options | array | The HTML attributes for the widget container tag. | hscstudio\heart\widgets\NavBar |
$renderInnerContainer | boolean | Whether the navbar content should be included in an inner div container which by default adds left and right padding. | hscstudio\heart\widgets\NavBar |
$screenReaderToggleText | string | Text to show for screen readers for the button to toggle the navbar. | hscstudio\heart\widgets\NavBar |
Public Methods
Method | Description | Defined By |
---|---|---|
init() | Initializes the widget. | hscstudio\heart\widgets\NavBar |
run() | Renders the widget. | hscstudio\heart\widgets\NavBar |
Protected Methods
Method | Description | Defined By |
---|---|---|
renderToggleButton() | Renders collapsible toggle button. | hscstudio\heart\widgets\NavBar |
Property Details
The text of the brand. Note that this is not HTML-encoded.
See also http://getbootstrap.com/components/#navbar.
The HTML attributes of the brand link.
See also \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
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.
The HTML attributes of the inner container.
See also \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
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.
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.
Text to show for screen readers for the button to toggle the navbar.
Method Details
Initializes the widget.
void init( ) |
Renders collapsible toggle button.
string renderToggleButton( $type = "nav" ) | ||
$type | ||
return | string | The rendering toggle button. |
---|
Renders the widget.
void run( ) |