コード例 #1
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     CommentListAsset::register($this->getView());
     $this->processDelete();
     $CommentsQuery = Comments\models\Comment::find()->byEntity($this->entity);
     if (false === $this->showDeleted) {
         $CommentsQuery->withoutDeleted();
     }
     $CommentsDataProvider = new \yii\data\ActiveDataProvider(['query' => $CommentsQuery->with(['author', 'lastUpdateAuthor']), 'pagination' => $this->pagination, 'sort' => $this->sort]);
     $content = $this->render('comment-list', ['CommentsDataProvider' => $CommentsDataProvider]);
     return \yii\helpers\Html::tag('div', $content, $this->options);
 }
コード例 #2
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     CommentListAsset::register($this->getView());
     $this->processDelete();
     /** @var Comments\models\Comment $CommentModel */
     $CommentModel = \Yii::createObject(Comments\Module::instance()->model('comment'));
     $CommentsQuery = $CommentModel::find()->byEntity($this->entity);
     if (false === $this->showDeleted) {
         $CommentsQuery->withoutDeleted();
     }
     $CommentsDataProvider = new \yii\data\ActiveDataProvider(['query' => $CommentsQuery->with(['author', 'lastUpdateAuthor']), 'pagination' => $this->pagination, 'sort' => $this->sort]);
     $params = $this->viewParams;
     $params['CommentsDataProvider'] = $CommentsDataProvider;
     $content = $this->render('comment-list', $params);
     return \yii\helpers\Html::tag('div', $content, $this->options);
 }
コード例 #3
0
 /**
  * Register asset bundle
  */
 protected function registerAssets()
 {
     CommentListAsset::register($this->getView());
 }