/** * @return ActiveDataProvider */ public function run($id = null) { $model = $id === null ? null : $this->findModel($id); if ($this->checkAccess) { call_user_func($this->checkAccess, $this->id, $model); } $searchModel = new ActionSearch(); if ($searchModel->load(\Yii::$app->request->getQueryParams())) { $searchModel->validate(); } $dataProvider = $this->prepareDataProvider($model, $searchModel); if (\Yii::$app->response->format === \yii\web\Response::FORMAT_HTML) { return $this->controller->render($this->viewName, ['model' => $model, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider]); } return $dataProvider; }