theme_comment_view

Versions
4.6
theme_comment_view($comment, $links = '', $visible = 1)
4.7 – 5
theme_comment_view($comment, $links = array(), $visible = 1)
6
theme_comment_view($comment, $node, $links = array(), $visible = TRUE)

Theme a single comment block.

Parameters

$comment The comment object.

$node The comment node.

$links An associative array containing control links.

$visible Switches between folded/unfolded view.

Related topics

Code

modules/comment/comment.module, line 1564

<?php
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;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.