Class hscstudio\heart\widgets\NavBar

Inheritancehscstudio\heart\widgets\NavBar » yii\bootstrap\Widget
Available since version2.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();

See also http://getbootstrap.com/components/#navbar.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined 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

Hide inherited methods

MethodDescriptionDefined By
init() Initializes the widget. hscstudio\heart\widgets\NavBar
run() Renders the widget. hscstudio\heart\widgets\NavBar

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
renderToggleButton() Renders collapsible toggle button. hscstudio\heart\widgets\NavBar

Property Details

$brandLabel public property

The text of the brand. Note that this is not HTML-encoded.

See also http://getbootstrap.com/components/#navbar.

$brandOptions public property

The HTML attributes of the brand link.

See also \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.

$brandUrl public property
$brandUrl null
$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.

$innerContainerOptions public property

The HTML attributes of the inner container.

See also \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.

$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.

$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.

$screenReaderToggleText public property
string $screenReaderToggleText 'Toggle navigation'

Text to show for screen readers for the button to toggle the navbar.

Method Details

init() public method

Initializes the widget.

void init( )
renderToggleButton() protected method

Renders collapsible toggle button.

string renderToggleButton$type "nav" )
$type
return string

The rendering toggle button.

run() public method

Renders the widget.

void run( )