/** * Executes the widget. */ public function run() { $modelName = $this->object->content->object_model; $modelId = $this->object->content->object_id; // Count all Comments $commentCount = \humhub\modules\comment\models\Comment::GetCommentCount($modelName, $modelId); $comments = \humhub\modules\comment\models\Comment::GetCommentsLimited($modelName, $modelId, 2); $isLimited = $commentCount > 2; return $this->render('comments', array('object' => $this->object, 'comments' => $comments, 'modelName' => $modelName, 'modelId' => $modelId, 'id' => $this->object->getUniqueId(), 'isLimited' => $isLimited, 'total' => $commentCount)); }