/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Slider::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'width' => $this->width, 'height' => $this->height, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'name', $this->name]); return $dataProvider; }
/** * Returns an array of the default params that are passed to a view * * @param Page $model The model that has to be passed to the view * @return array */ protected function getDefaultViewParams($model = null) { return ['model' => $model, 'templates' => $this->getTemplates(), 'sliders' => $this->module->enableSliders ? ArrayHelper::map(\infoweb\sliders\models\Slider::find()->select(['id', 'name'])->orderBy('name')->all(), 'id', 'name') : [], 'forms' => $this->module->enableForm ? ArrayHelper::map(\infoweb\form\models\form\FormLang::find()->select(['form_id', 'name'])->where(['=', 'language', Yii::$app->language])->orderBy('name')->all(), 'form_id', 'name') : [], 'menus' => $this->module->enableMenu ? ArrayHelper::map(\infoweb\menu\models\Menu::find()->select(['id', 'name'])->orderBy('name')->all(), 'id', 'name') : [], 'allowContentDuplication' => $this->module->allowContentDuplication]; }