public function views_plugin_row_comment_view::pre_render in Views (for Drupal 7) 7.3
Same name and namespace in other branches
- 6.3 modules/comment/views_plugin_row_comment_view.inc \views_plugin_row_comment_view::pre_render()
- 6.2 modules/comment/views_plugin_row_comment_view.inc \views_plugin_row_comment_view::pre_render()
Allow the style to do stuff before each row is rendered.
Parameters
array $result: The full array of results from the query.
Overrides views_plugin_row::pre_render
File
- modules/
comment/ views_plugin_row_comment_view.inc, line 94 - Definition of views_plugin_row_comment_view.
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;
}
}