yii\bootstrap\Nav::init PHP Method

init() public method

Initializes the widget.
public init ( )
    public function init()
    {
        parent::init();
        if ($this->route === null && Yii::$app->controller !== null) {
            $this->route = Yii::$app->controller->getRoute();
        }
        if ($this->params === null) {
            $this->params = Yii::$app->request->getQueryParams();
        }
        if ($this->dropDownCaret === null) {
            $this->dropDownCaret = '<span class="caret"></span>';
        }
        Html::addCssClass($this->options, ['widget' => 'nav']);
    }

Usage Example

Example #1
0
 /**
  * Initialize the widget
  * @throws InvalidConfigException
  */
 public function init()
 {
     if (!class_exists($this->dropdownClass)) {
         throw new InvalidConfigException("The dropdownClass '{$this->dropdownClass}' does not exist or is not accessible.");
     }
     parent::init();
 }
All Usage Examples Of yii\bootstrap\Nav::init