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