function views_plugin_row_comment_view::pre_render

Overrides views_plugin_row::pre_render

File

modules/comment/views_plugin_row_comment_view.inc, line 94

Class

views_plugin_row_comment_view
Plugin which performs a comment_view on the resulting object.

Code

public function pre_render($result) {
    $cids = array();
    foreach ($result as $row) {
        $cids[] = $row->cid;
    }
    // Load all comments.
    $cresult = comment_load_multiple($cids);
    $nids = array();
    foreach ($cresult as $comment) {
        $comment->depth = count(explode('.', $comment->thread)) - 1;
        $this->comments[$comment->cid] = $comment;
        $nids[] = $comment->nid;
    }
    // Load all nodes of the comments.
    $nodes = node_load_multiple(array_unique($nids));
    foreach ($nodes as $node) {
        $this->nodes[$node->nid] = $node;
    }
}