comment_build_content
- Versions
- 7
comment_build_content($comment, $node, $build_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 $build_mode parameter.
Parameters
$comment A comment object.
$node The node the comment is attached to.
$build_mode Build mode, e.g. 'full', 'teaser'...
Code
modules/comment/comment.module, line 831
<?php
function comment_build_content($comment, $node, $build_mode = 'full') {
// Remove previously built content, if exists.
$comment->content = array();
// Build comment body.
$comment->content['comment_body'] = array(
'#markup' => check_markup($comment->comment, $comment->format, '', TRUE),
);
// Build fields content.
field_attach_prepare_view('comment', array($comment->cid => $comment), $build_mode);
$comment->content += field_attach_view('comment', $comment, $build_mode);
if (empty($comment->in_preview)) {
$comment->content['links']['comment'] = array(
'#theme' => 'links',
'#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, $build_mode);
}
?>Login or register to post comments 