hook_node_search_result
function hook_node_search_result
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_view() have been called.
Parameters
$node: The node being displayed in a search result.
Return value
array Extra information to be displayed with search result. This information should be presented as an associative array. It will be concatenated with the post information (last updated, author) in the default search result theming.
See also
template_preprocess_search_result()
Related topics
File
- modules/node/node.api.php, line 671
- Hooks provided by the Node module.
Code
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 array('comment' => format_plural($comments, '1 comment', '@count comments')); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!node!node.api.php/function/hook_node_search_result/7.x