/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Files::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['date' => SORT_DESC]]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'size' => $this->size, 'width' => $this->width, 'height' => $this->height, 'date' => $this->date, 'date_gmt' => $this->date_gmt, 'update' => $this->update, 'update_gmt' => $this->update_gmt]);
     $query->andFilterWhere(['like', 'url', $this->url])->andFilterWhere(['like', 'thumbnail_url', $this->thumbnail_url])->andFilterWhere(['like', 'file_name', $this->file_name])->andFilterWhere(['like', 'type', $this->type])->andFilterWhere(['like', 'title', $this->title]);
     return $dataProvider;
 }
 /**
  * run function.
  *
  * @access public
  * @return void
  */
 public function run()
 {
     $randomId = uniqid();
     if (isset($this->clientOptions['fileTypes']) && !in_array('*', $this->clientOptions['fileTypes'])) {
         echo 'here';
         $where = ['type' => $this->clientOptions['fileTypes']];
     } else {
         $where = [];
     }
     $imageArray = ArrayHelper::map(Files::find()->select(['id', 'title'])->where($where)->orderBy('title')->all(), 'id', 'title');
     $selectOptions = ArrayHelper::merge(['' => 'Select a Thumbnail'], $imageArray);
     if ($this->hasModel()) {
         echo Html::activeDropDownList($this->model, $this->attribute, $selectOptions, $this->options);
     } else {
         echo Html::dropDownList($this->name, $this->value, $selectOptions, $this->options);
     }
 }