comment_build_multiple
- Versions
- 7
comment_build_multiple($comments, $node, $build_mode = 'full', $weight = 0)
Construct a drupal_render() style array from an array of loaded comments.
Parameters
$comments An array of comments as returned by comment_load_multiple().
$node The node the comments are attached to.
$build_mode Build mode, e.g. 'full', 'teaser'...
$weight An integer representing the weight of the first comment in the list.
Return value
An array in the format expected by drupal_render().
Code
modules/comment/comment.module, line 943
<?php
function comment_build_multiple($comments, $node, $build_mode = 'full', $weight = 0) {
field_attach_prepare_view('comment', $comments, $build_mode);
$build = array(
'#sorted' => TRUE,
);
foreach ($comments as $comment) {
$build[$comment->cid] = comment_build($comment, $node, $build_mode);
$build[$comment->cid]['#weight'] = $weight;
$weight++;
}
return $build;
}
?>Login or register to post comments 