/**
  * Creates a new MenuItem model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @param null $menuTypeId
  * @param null $parentId
  * @param string|null $backUrl
  * @return string|\yii\web\Response
  * @throws NotFoundHttpException
  */
 public function actionCreate($menuTypeId = null, $parentId = null, $backUrl = null)
 {
     $model = new MenuItem();
     $model->loadDefaultValues();
     $model->status = MenuItem::STATUS_PUBLISHED;
     // по дефолту выставляем ендпоинт на "временную старницу"
     $model->link_type = MenuItem::LINK_ROUTE;
     $model->link = 'main/frontend/default/dummy-page';
     if (isset($menuTypeId)) {
         $model->menu_type_id = $menuTypeId;
     }
     if (isset($parentId)) {
         $parentCategory = $this->findModel($parentId);
         $model->parent_id = $parentCategory->id;
     }
     $linkParamsModel = new MenuLinkParams();
     $linkParamsModel->setAttributes($model->getLinkParams());
     if ($model->load(Yii::$app->request->post()) && $linkParamsModel->load(Yii::$app->request->post()) && $model->validate() && $linkParamsModel->validate()) {
         $model->setLinkParams($linkParamsModel->toArray());
         $model->saveNode(false);
         return $this->redirect($backUrl ? $backUrl : ['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model, 'linkParamsModel' => $linkParamsModel]);
     }
 }