/** * @inheritdoc */ public function run() { CommentFormAsset::register($this->getView()); $CommentCreateForm = new Comments\forms\CommentCreateForm(['Comment' => $this->Comment, 'entity' => $this->entity]); if ($CommentCreateForm->load(\Yii::$app->getRequest()->post())) { if ($CommentCreateForm->validate()) { if ($CommentCreateForm->save()) { \Yii::$app->getResponse()->refresh(sprintf($this->anchor, $CommentCreateForm->Comment->id))->send(); exit; } } } return $this->render('comment-form', ['CommentCreateForm' => $CommentCreateForm]); }
/** * @inheritdoc */ public function run() { CommentFormAsset::register($this->getView()); /** @var Comments\forms\CommentCreateForm $CommentCreateForm */ $CommentCreateFormClassData = Comments\Module::instance()->model('commentCreateForm', ['Comment' => $this->Comment, 'entity' => $this->entity]); $CommentCreateForm = \Yii::createObject($CommentCreateFormClassData); if ($CommentCreateForm->load(\Yii::$app->getRequest()->post())) { if ($CommentCreateForm->validate()) { if ($CommentCreateForm->save()) { \Yii::$app->getResponse()->refresh(sprintf($this->anchor, $CommentCreateForm->Comment->id))->send(); exit; } } } return $this->render('comment-form', ['CommentCreateForm' => $CommentCreateForm]); }
/** * Register asset bundle */ protected function registerAssets() { CommentFormAsset::register($this->getView()); }