protected function afterLike($entityType, $entityId) { $cmp = new NEWSFEED_CMP_Likes($entityType, $entityId); echo json_encode(array('count' => $cmp->getCount(), 'markup' => $cmp->render())); exit; }
protected function getFeatures($data) { $configs = $this->sharedData['configs']; $featuresData = $this->getFeaturesData($data); $out = array('system' => array('comments' => false, 'likes' => false), 'custom' => array()); $out['custom'] = $featuresData["custom"]; $systemFeatures = $featuresData["system"]; if (!empty($systemFeatures["comments"])) { $feature = $systemFeatures["comments"]; $commentsParams = new BASE_CommentsParams($feature["authGroup"], $feature["entityType"]); $commentsParams->setEntityId($feature["entityId"]); $commentsParams->setInitialCommentsCount($configs['comments_count']); $commentsParams->setLoadMoreCount(6); $commentsParams->setBatchData($feature["comments"]); $commentsParams->setOwnerId($this->action->getUserId()); $commentsParams->setDisplayType(BASE_CommentsParams::DISPLAY_TYPE_WITH_LOAD_LIST_MINI); $commentsParams->setWrapInBox(false); $commentsParams->setShowEmptyList(false); if (!empty($feature['error'])) { $commentsParams->setErrorMessage($feature['error']); } if (isset($feature['allow'])) { $commentsParams->setAddComment($feature['allow']); } $commentCmp = new BASE_CMP_Comments($commentsParams); $out['system']['comments']['cmp'] = $commentCmp->render(); $out['system']['comments']['count'] = $feature["count"]; $out['system']['comments']['allow'] = $feature["allow"]; $out['system']['comments']['expanded'] = $feature["expanded"]; } if (!empty($systemFeatures["likes"])) { $feature = $systemFeatures['likes']; $out['system']['likes']['count'] = $feature["count"]; $out['system']['likes']['liked'] = $feature["liked"]; $out['system']['likes']['allow'] = $feature["allow"]; $out['system']['likes']['error'] = $feature["error"]; $likeCmp = new NEWSFEED_CMP_Likes($feature["entityType"], $feature["entityId"], $feature["likes"]); $out['system']['likes']['cmp'] = $likeCmp->render(); } return $out; }