/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = PatternType::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'alias', $this->alias]); return $dataProvider; }
<div class="pattern-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'group_id')->dropdownList(\common\models\PatternGroup::find()->select(['name', 'id'])->indexBy('id')->column(), ['prompt' => 'Group:'])->label('Group'); ?> <?php echo $form->field($model, 'module')->dropDownList(['country' => 'Country', 'city' => 'City', 'direction' => 'Direction', 'airport' => 'Airport', 'airline' => 'Airline'], ['prompt' => '']); ?> <?php echo $form->field($model, 'type_id')->dropdownList(\common\models\PatternType::find()->select(['alias', 'id'])->indexBy('id')->column(), ['prompt' => 'Type:'])->label('Type'); ?> <?php // if ($model && $model->type->is_editor) ?> <?php echo $form->field($model, 'value')->widget(\vova07\imperavi\Widget::className(), ['settings' => ['lang' => 'ru', 'minHeight' => 200, 'plugins' => ['clips', 'fullscreen'], 'pastePlainText' => false, 'paragraphize' => false]]); ?> <?php //= $form->field($model, 'priority')->textInput() ?> <div class="form-group">