public function run() { $model = new Comment(); $model->parent_id = (int) Yii::$app->getRequest()->post('parent_id'); $model->entity = (string) Yii::$app->getRequest()->post('entity'); $model->entity_id = (int) Yii::$app->getRequest()->post('entity_id'); $content = CommentsForm::widget(["model" => $model]); return $this->controller->renderJsonMessage(true, $content); }
<?php use hass\comment\widgets\CommentsForm; use hass\comment\widgets\CommentsList; /* @var $this yii\web\View */ /* @var $model hass\comment\models\Comment */ ?> <div class="panel"> <div class="panel-body"> <?php echo CommentsForm::widget(['entity' => $entity, "entity_id" => $entity_id, "commentUrl" => $commentUrl]); ?> </div> </div> <?php echo CommentsList::widget(['entity' => $entity, "entity_id" => $entity_id, "replyFormUrl" => $replyFormUrl]);