hook_node_search_result

Versions
7
hook_node_search_result($node)

Act on a node being displayed as a search result.

This hook is invoked from node_search_execute(), after node_load() and node_build() have been called.

Parameters

$node The node being displayed in a search result.

Return value

Extra information to be displayed with search result.

Related topics

Code

modules/node/node.api.php, line 452

<?php
function hook_node_search_result($node) {
  $comments = db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = :nid', array('nid' => $node->nid))->fetchField();
  return format_plural($comments, '1 comment', '@count comments');
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.