/** * Creates a new AdditionalField record model. * If creation is successful, the browser will be redirected to the 'index' page. * @return mixed */ public function actionCreate() { $model = new AdditionalFieldRecord(); if ($model->load(Yii::$app->request->post())) { $session = Yii::$app->session; if (!$session['language_id']) { $session['language_id'] = LanguageRecord::getMainLanguageId(); } $model->language_id = $session['language_id']; if ($model->save()) { $session->setFlash('info', Yii::t('back', 'New additional field successfully added!')); return $this->redirect('index'); } } elseif (Yii::$app->request->isAjax) { return $this->renderAjax('_form', compact('model')); } return $this->render('_form', compact('model')); }