function comment_view

cis7 comment.module comment_view($comment, $node, $view_mode = 'full', $langcode = NULL)
cle7 comment.module comment_view($comment, $node, $view_mode = 'full', $langcode = NULL)
elmsmedia7 comment.module comment_view($comment, $node, $view_mode = 'full', $langcode = NULL)
icor7 comment.module comment_view($comment, $node, $view_mode = 'full', $langcode = NULL)
meedjum_blog7 comment.module comment_view($comment, $node, $view_mode = 'full', $langcode = NULL)
mooc7 comment.module comment_view($comment, $node, $view_mode = 'full', $langcode = NULL)

Generate an array for rendering the given comment.


$comment: A comment object.

$node: The node the comment is attached to.

$view_mode: View mode, e.g. 'full', 'teaser'...

$langcode: (optional) A language code to use for rendering. Defaults to the global content language of the current request.

Return value

An array as expected by drupal_render().

5 calls to comment_view()
comment_preview in modules/comment/comment.module
Generate a comment preview.
comment_reply in modules/comment/
This function is responsible for generating a comment reply form. There are several cases that have to be handled, including:
comment_view_multiple in modules/comment/comment.module
Construct a drupal_render() style array from an array of loaded comments.
ds_views_row_render_comment in sites/all/modules/ulmus/ds/views/
Render the comment through the entity plugin.
views_plugin_row_comment_rss::render in sites/all/modules/ulmus/views/modules/comment/
Render a row object. This usually passes through to a theme template of some form, but not always.
3 string references to 'comment_view'
comment_build_content in modules/comment/comment.module
Builds a structured array representing the comment's content.
trigger_comment_view in modules/trigger/trigger.module
Implements hook_comment_view().
trigger_trigger_info in modules/trigger/trigger.module
Implements hook_trigger_info().


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


function comment_view($comment, $node, $view_mode = 'full', $langcode = NULL) {
  if (!isset($langcode)) {
    $langcode = $GLOBALS['language_content']->language;

  // Populate $comment->content with a render() array.
  comment_build_content($comment, $node, $view_mode, $langcode);

  $build = $comment->content;
  // We don't need duplicate rendering info in comment->content.

  $build += array(
    '#theme' => 'comment__node_' . $node->type,
    '#comment' => $comment,
    '#node' => $node,
    '#view_mode' => $view_mode,
    '#language' => $langcode,

  if (empty($comment->in_preview)) {
    $prefix = '';
    $is_threaded = isset($comment->divs) && variable_get('comment_default_mode_' . $node->type, COMMENT_MODE_THREADED) == COMMENT_MODE_THREADED;

    // Add 'new' anchor if needed.
    if (!empty($comment->first_new)) {
      $prefix .= "<a id=\"new\"></a>\n";

    // Add indentation div or close open divs as needed.
    if ($is_threaded) {
      $prefix .= $comment->divs <= 0 ? str_repeat('</div>', abs($comment->divs)) : "\n" . '<div class="indented">';

    // Add anchor for each comment.
    $prefix .= "<a id=\"comment-$comment->cid\"></a>\n";
    $build['#prefix'] = $prefix;

    // Close all open divs.
    if ($is_threaded && !empty($comment->divs_final)) {
      $build['#suffix'] = str_repeat('</div>', $comment->divs_final);

  // Allow modules to modify the structured comment.
  $type = 'comment';
  drupal_alter(array('comment_view', 'entity_view'), $build, $type);

  return $build;



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.