function helper_node_load in Helper 7
Implements hook_node_load().
File
- ./
helper.node.inc, line 11 - Node hooks implemented by the Helper module.
Code
function helper_node_load(array $nodes) {
// Add an unpublished comment count property to loaded nodes.
if (module_exists('comment') && helper_is_tweak_enabled('node_comment_unpublished_count')) {
$unpublished_counts = db_query('SELECT nid, COUNT(cid) FROM {comment} WHERE nid IN (:nids) AND status = :status GROUP BY nid', array(
':nids' => array_keys($nodes),
':status' => COMMENT_NOT_PUBLISHED,
))
->fetchAllKeyed();
$unpublished_counts += array_fill_keys(array_keys($nodes), 0);
foreach ($nodes as $node) {
$node->comment_unpublished_count = $unpublished_counts[$node->nid];
}
}
}