/** * @return string|\yii\web\Response * @throws \yii\web\ServerErrorHttpException */ public function actionSettings() { if (Yii::$app->request->isPost) { $model = new Yml(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { $model->saveConfig(); } elseif ($model->hasErrors()) { Yii::$app->session->setFlash('error', Helper::formatModelErrors($model, '<br />')); } return $this->refresh(); } $model = new Yml(); $model->loadConfig(); return $this->render('settings', ['model' => $model]); }