function theme_heartbeat_comments in Heartbeat 7
Same name and namespace in other branches
- 6.4 modules/heartbeat_comments/heartbeat_comments.module \theme_heartbeat_comments()
Theme function for heartbeat comments
Parameters
$comments Array of comment/reaction objects:
$type Boolean to indicate whether it is a node comment or not:
Return value
String Themed output for comments
3 theme calls to theme_heartbeat_comments()
- HeartbeatActivityCommentsPlugin::renderAttachmentsContent in modules/
heartbeat_comments/ plugins/ activitycomments.inc - renderAttachmentsContent().
- heartbeat_comments_form_submit in modules/
heartbeat_comments/ heartbeat_comments.module - User submitted a heartbeat comment.
- heartbeat_comments_load_js in modules/
heartbeat_comments/ heartbeat_comments.module - Ajax callback to load all the comments.
File
- modules/
heartbeat_comments/ heartbeat_comments.module, line 600 - Heartbeat comments for activity.
Code
function theme_heartbeat_comments($variables) {
$reactions = $variables['comments'];
$heartbeatActivity = $variables['activity'];
$is_node_comment = FALSE;
$nid = 0;
if (isset($heartbeatActivity->additions->plugins)) {
$commentsPlugin = $heartbeatActivity->additions->plugins['activitycomments'];
$is_node_comment = $commentsPlugin->isNodeComment;
}
$comments = $reactions;
if (empty($comments)) {
return '';
}
$output = '';
//$output .= '<h4>' . t('Reactions') . '</h4>';
$comment = current($comments);
$output .= '<ul class="summary" id="heartbeat-comments-list-' . $heartbeatActivity->uaid . '">';
$i = 1;
$max = count($comments);
foreach ($comments as $comment) {
$i++;
$nid = !empty($comment->nid) ? $comment->nid : $nid;
$output .= theme('heartbeat_comment', array(
'comment' => $comment,
'node_comment' => $is_node_comment,
'last' => $i == $max,
));
}
// Add more button.
if (isset($commentsPlugin) && $commentsPlugin->hasMoreComments) {
$link = heartbeat_comments_load_more_link($heartbeatActivity->uaid, $is_node_comment, $nid);
$output .= '<li class="heartbeat-comment heartbeat-comment-more">' . $link . '</li>';
}
$output .= '</ul>';
return $output;
}