public function actionUpdate($type) { $settings = SiteService::getAttributeMapBySlugType(Yii::$app->cmgCore->getSiteSlug(), $type); $fieldsMap = FormUtil::fillFromModelAttribute("config-{$type}", $settings); $model = new GenericForm(['fields' => $fieldsMap]); if ($model->load(Yii::$app->request->post(), 'GenericForm') && $model->validate()) { $settings = FormUtil::getModelAttributes($model, $settings); ModelAttributeService::updateAll($settings); return $this->redirect("index?type={$type}"); } return $this->render('update', ['model' => $model, 'type' => $type]); }