You are here

function theme_comment_view in Drupal 6

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

Themes a single comment and related items.

Parameters

$comment: The comment object.

$node: The comment node.

$links: An associative array containing control links suitable for passing into theme_links(). These are generated by modules implementing hook_link() with $type='comment'. Typical examples are links for editing and deleting comments.

$visible: Switches between folded/unfolded view. If TRUE the comments are visible, if FALSE the comments are folded.

Related topics

7 theme calls to theme_comment_view()
comment_form_add_preview in modules/comment/comment.module
Form builder; Generate and validate a comment preview form.
comment_render in modules/comment/comment.module
Renders comment(s).
comment_reply in modules/comment/comment.pages.inc
This function is responsible for generating a comment reply form. There are several cases that have to be handled, including:
theme_comment_flat_collapsed in modules/comment/comment.module
Theme comment flat collapsed view.
theme_comment_flat_expanded in modules/comment/comment.module
Theme comment flat expanded view.

... See full list

File

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

Code

function theme_comment_view($comment, $node, $links = array(), $visible = TRUE) {
  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, $node, $links);
  }
  else {
    $output .= theme('comment_folded', $comment);
  }
  return $output;
}