macgyer\yii2materializecss\widgets\NavBar::init PHP Method

init() public method

Initializes the widget.
public init ( )
    public function init()
    {
        parent::init();
        $this->clientOptions = false;
        $html = [];
        if (empty($this->options['role'])) {
            $this->options['role'] = 'navigation';
        }
        if ($this->fixed) {
            Html::addCssClass($this->fixedContainerOptions, 'navbar-fixed');
            $html[] = Html::beginTag('div', $this->fixedContainerOptions);
        }
        $html[] = Html::beginTag('nav', $this->options);
        Html::addCssClass($this->wrapperOptions, 'nav-wrapper');
        $html[] = Html::beginTag('div', $this->wrapperOptions);
        if ($this->brandLabel !== false) {
            Html::addCssClass($this->brandOptions, ['widget' => 'brand-logo']);
            $html[] = Html::a($this->brandLabel, $this->brandUrl === false ? Yii::$app->homeUrl : $this->brandUrl, $this->brandOptions);
        }
        if (!isset($this->containerOptions['id'])) {
            $this->containerOptions['id'] = "{$this->id}-collapse";
        }
        $html[] = $this->renderToggleButton();
        $html[] = Html::beginTag('div', $this->containerOptions);
        echo implode("\n", $html);
    }