PHP Class macgyer\yii2materializecss\widgets\NavBar

Any content enclosed between the \yii\base\Widget::begin()-detail) and \yii\base\Widget::end()-detail) calls of NavBar is treated as the content of the navbar. You may use widgets such as [[Nav|Nav]] or \yii\widgets\Menu to build up such content. For example, php use macgyer\yii2materializecss\widgets\NavBar; use macgyer\yii2materializecss\widgets\Nav; NavBar::begin(['brandLabel' => 'NavBar Test']); echo Nav::widget([ 'items' => [ ['label' => 'Home', 'url' => ['/site/index']], ['label' => 'About', 'url' => ['/site/about']], ], ]); NavBar::end();
See also: http://materializecss.com/navbar.html
Author: Christoph Erdmann ([email protected])
Inheritance: extends macgyer\yii2materializecss\lib\BaseWidget
Show file Open project: macgyer/yii2-materializecss Class Usage Examples

Public Properties

Property Type Description
$brandLabel the text of the brand or false if it's not used. Note that this is not HTML-encoded.
$brandOptions the HTML attributes of the brand link.
$brandUrl array | string | boolean
$containerOptions the HTML attributes of the inner container.
$fixed 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.
$fixedContainerOptions the HTML attributes of the fixed container.
$options 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.
$screenReaderToggleText text to show for screen readers for the button to toggle the navbar.
$wrapperOptions the HTML attributes of the navigation wrapper container.

Public Methods

Method Description
init ( ) Initializes the widget.
run ( ) Renders the widget.

Protected Methods

Method Description
registerToggleButtonScript ( string $targetId ) Registers the JS for the toggle button.
renderToggleButton ( ) : string Renders collapsible toggle button.

Method Details

init() public method

Initializes the widget.
public init ( )

registerToggleButtonScript() protected method

Registers the JS for the toggle button.
protected registerToggleButtonScript ( string $targetId )
$targetId string the ID of the toggled navigation.

renderToggleButton() protected method

Renders collapsible toggle button.
protected renderToggleButton ( ) : string
return string the rendered toggle button.

run() public method

Renders the widget.
public run ( )

Property Details

$brandLabel public property

the text of the brand or false if it's not used. Note that this is not HTML-encoded.
See also: http://materializecss.com/navbar.html
public $brandLabel

$brandOptions public property

the HTML attributes of the brand link.
See also: [\yii\helpers\Html::renderTagAttributes()](http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#renderTagAttributes()-detail) for details on how attributes are being rendered.
public $brandOptions

$brandUrl public property

public array|string|bool $brandUrl
return array | string | boolean

$containerOptions public property

the HTML attributes of the inner container.
See also: [\yii\helpers\Html::renderTagAttributes()](http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#renderTagAttributes()-detail) for details on how attributes are being rendered.
public $containerOptions

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

$fixedContainerOptions public property

the HTML attributes of the fixed container.
See also: [\yii\helpers\Html::renderTagAttributes()](http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#renderTagAttributes()-detail) for details on how attributes are being rendered.
public $fixedContainerOptions

$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()](http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#renderTagAttributes()-detail) for details on how attributes are being rendered.
public $options

$screenReaderToggleText public property

text to show for screen readers for the button to toggle the navbar.
public $screenReaderToggleText

$wrapperOptions public property

the HTML attributes of the navigation wrapper container.
See also: [\yii\helpers\Html::renderTagAttributes()](http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#renderTagAttributes()-detail) for details on how attributes are being rendered.
public $wrapperOptions