1 views_plugin_row_comment_view.inc | views_plugin_row_comment_view::pre_render($result) |
Allow the style to do stuff before each row is rendered.
Parameters
$result: The full array of results from the query.
Overrides views_plugin_row::pre_render
File
- core/
modules/ comment/ views/ views_plugin_row_comment_view.inc, line 74 - Contains the node RSS row style plugin.
Class
- views_plugin_row_comment_view
- Plugin which performs a comment_view on the resulting object.
Code
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;
}
}