comment_build_content

Versions
mediamosa-21
comment_build_content($comment, $node, $view_mode = 'full')

Builds a structured array representing the comment's content.

The content built for the comment (field values, comments, file attachments or other comment components) will vary depending on the $view_mode parameter.

Parameters

$comment A comment object.

$node The node the comment is attached to.

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

Code

modules/comment/comment.module, line 937

<?php
function comment_build_content($comment, $node, $view_mode = 'full') {
  // Remove previously built content, if exists.
  $comment->content = array();

  // Build fields content.
  field_attach_prepare_view('comment', array($comment->cid => $comment), $view_mode);
  entity_prepare_view('comment', array($comment->cid => $comment));
  $comment->content += field_attach_view('comment', $comment, $view_mode);

  if (empty($comment->in_preview)) {
    $comment->content['links']['comment'] = array(
      '#theme' => 'links__comment',
      '#links' => comment_links($comment, $node),
      '#attributes' => array('class' => array('links', 'inline')),
    );
  }

  // Allow modules to make their own additions to the comment.
  module_invoke_all('comment_view', $comment, $view_mode);
}
?>