/**
  * Создание нового поля шаблона
  * @return string|\yii\web\Response
  */
 public function actionCreate()
 {
     $model = new Field();
     $model->template_id = Yii::$app->request->get('template_id');
     $model->min = 0;
     $model->max = 1;
     $template = Template::findOne($model->template_id);
     if ($template == null) {
         throw new NotFoundHttpException(Yii::t('document', 'Запрашиваемая страница не найдена'));
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->getSession()->setFlash('success', Yii::t('document', 'Новый поле создано.'));
         return $this->redirect(['template/update', 'id' => $model->template_id]);
     } else {
         return $this->render('@vendor/lowbase/yii2-document/views/field/create', ['model' => $model, 'template' => $template]);
     }
 }