You are here

function theme_comment_view in Drupal 4

Same name and namespace in other branches
  1. 5 modules/comment/comment.module \theme_comment_view()
  2. 6 modules/comment/comment.module \theme_comment_view()
8 theme calls to theme_comment_view()
comment_form_add_preview in modules/comment.module
comment_render in modules/comment.module
comment_reply in modules/comment.module
theme_comment_flat_collapsed in modules/comment.module
theme_comment_flat_expanded in modules/comment.module

... See full list

File

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

Code

function theme_comment_view($comment, $links = array(), $visible = 1) {
  static $first_new = TRUE;
  $output = '';
  $comment->new = node_mark($comment->nid, $comment->timestamp);
  if ($first_new && $comment->new != MARK_READ) {

    // Assign the anchor only for the first new comment. This avoids duplicate
    // id attributes on a page.
    $first_new = FALSE;
    $output .= "<a id=\"new\"></a>\n";
  }
  $output .= "<a id=\"comment-{$comment->cid}\"></a>\n";

  // Switch to folded/unfolded view of the comment
  if ($visible) {
    $comment->comment = check_markup($comment->comment, $comment->format, FALSE);

    // Comment API hook
    comment_invoke_comment($comment, 'view');
    $output .= theme('comment', $comment, $links);
  }
  else {
    $output .= theme('comment_folded', $comment);
  }
  return $output;
}