/** * @inheritdoc */ public function init() { $cssClass = @$this->options['class']; parent::init(); // significant order if ($cssClass != $this->options['class']) { \yii\helpers\Html::removeCssClass($this->options, 'nav'); } $this->items = Item::find()->select(['*', 'parent_id' => '(IF(pid=1,"",pid))', 'name' => 'title'])->where(['visible' => true])->andWhere(['<>', 'pid', ''])->indexBy('id')->orderBy(['rank' => SORT_ASC])->asArray()->all(); }
public function init() { $this->generateItems(); parent::init(); }