You are here

function theme_heartbeat_comments in Heartbeat 6.4

Same name and namespace in other branches
  1. 7 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()
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.
heartbeat_comments_widget in modules/heartbeat_comments/heartbeat_comments.module
Implementation of <attchement>_widget().

File

modules/heartbeat_comments/heartbeat_comments.module, line 635
heartbeat_comments.module Heartbeat comments can come with two possible

Code

function theme_heartbeat_comments($comments, $uaid, $node_comment = FALSE, $has_more = FALSE) {
  if (empty($comments)) {
    return '';
  }
  $output = '';

  //$output .= '<h4>' . t('Reactions') . '</h4>';
  $comment = current($comments);
  $output .= '<ul class="summary" id="heartbeat-comments-list-' . $uaid . '">';
  $i = 1;
  $max = count($comments);
  foreach ($comments as $comment) {
    $i++;
    $output .= theme('heartbeat_comment', $comment, $node_comment, $i == $max);
  }

  // Add more button.
  if ($has_more) {
    $link = heartbeat_comments_load_more_link($uaid, $node_comment, isset($comment->nid) ? $comment->nid : 0);
    $output .= '<li class="heartbeat-comment heartbeat-comment-more">' . $link . '</li>';
  }
  $output .= '</ul>';
  return $output;
}