You are here

function theme_comment_block in Drupal 7

Same name and namespace in other branches
  1. 4 modules/comment.module \theme_comment_block()
  2. 5 modules/comment/comment.module \theme_comment_block()
  3. 6 modules/comment/comment.module \theme_comment_block()

Returns HTML for a list of recent comments to be displayed in the comment block.

Related topics

1 theme call to theme_comment_block()
comment_block_view in modules/comment/comment.module
Implements hook_block_view().

File

modules/comment/comment.module, line 597
Enables users to comment on published content.

Code

function theme_comment_block() {
  $items = array();
  $number = variable_get('comment_block_count', 10);
  foreach (comment_get_recent($number) as $comment) {
    $items[] = l($comment->subject, 'comment/' . $comment->cid, array(
      'fragment' => 'comment-' . $comment->cid,
    )) . '&nbsp;<span>' . t('@time ago', array(
      '@time' => format_interval(REQUEST_TIME - $comment->changed),
    )) . '</span>';
  }
  if ($items) {
    return theme('item_list', array(
      'items' => $items,
    ));
  }
  else {
    return t('No comments available.');
  }
}