function theme_comment_block

Returns HTML for a list of recent comments.

Related topics

1 theme call to theme_comment_block()
RecentCommentsBlock::build in drupal/core/modules/comment/lib/Drupal/comment/Plugin/Block/RecentCommentsBlock.php
Builds and returns the renderable array for this block plugin.

File

drupal/core/modules/comment/comment.module, line 549
Enables users to comment on published content.

Code

function theme_comment_block($variables) {
  $items = array();
  $number = $variables['number'];
  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.');
  }
}