/** * Fetch setting * * @return string */ public function actionGetConfig() { $model = new DynaGridSettings(); $out = ['status' => '', 'content' => '']; if ($model->load(Yii::$app->request->post()) && $model->validate()) { $out = ['status' => 'success', 'content' => print_r($model->getDataConfig(), true)]; } echo Json::encode($out); }
/** * Fetch setting * * @return string */ public function actionGetConfig() { Yii::$app->response->format = Response::FORMAT_JSON; $model = new DynaGridSettings(); $out = ['status' => '', 'content' => '']; if ($model->load(Yii::$app->request->post()) && $model->validate()) { $out = ['status' => 'success', 'content' => print_r($model->getDataConfig(), true)]; } return $out; }
/** * @inheritdoc */ public function init() { if (empty($this->model) || !$this->model instanceof DynaGridSettings) { throw new InvalidConfigException("You must enter a valid 'model' for DynaGridDetail extending from '" . DynaGridSettings::classname() . "'"); } parent::init(); $this->_module = Config::initModule(Module::classname()); $this->_requestSubmit = $this->options['id'] . '-dynagrid-detail'; $this->_isSubmit = !empty($_POST[$this->_requestSubmit]) && $this->model->load(Yii::$app->request->post()) && $this->model->validate(); $this->registerAssets(); }