comment_view_multiple($comments, $node, $view_mode = 'full', $weight = 0)Construct a drupal_render() style array from an array of loaded comments.
$comments An array of comments as returned by comment_load_multiple().
$node The node the comments are attached to.
$view_mode View mode, e.g. 'full', 'teaser'...
$weight An integer representing the weight of the first comment in the list.
An array in the format expected by drupal_render().
modules/comment/comment.module, line 1033
<?php
function comment_view_multiple($comments, $node, $view_mode = 'full', $weight = 0) {
field_attach_prepare_view('comment', $comments, $view_mode);
entity_prepare_view('comment', $comments);
$build = array(
'#sorted' => TRUE,
);
foreach ($comments as $comment) {
$build[$comment->cid] = comment_view($comment, $node, $view_mode);
$build[$comment->cid]['#weight'] = $weight;
$weight++;
}
return $build;
}
?>