function hook_term_search_result in Term Search 7
Act on a term being displayed as a search result.
This hook is invoked from term_search_search_execute(), after taxonomy_term_load() and taxonomy_term_view() have been called.
Parameters
$term: The term object being display in a search result.
Return value
A string (can include html) that will be added to the rendered search result for this term.
1 invocation of hook_term_search_result()
- term_search_search_execute in ./
term_search.module - Implements hook_search_execute().
File
- ./
term_search.api.php, line 68 - This file contains no working PHP code; it exists to provide additional documentation for doxygen as well as to document hooks in the standard Drupal manner.
Code
function hook_term_search_result($term) {
$text = '';
$query = db_select('users', 'u');
$query
->rightJoin('field_data_field_affiliation', 'a', 'a.entity_id=u.uid');
$uids = $query
->addField('u', 'uid')
->condition('a.field_affiliation_tid', $term->tid)
->countQuery()
->execute()
->fetchField();
foreach ($uids as $uid) {
$account = user_load($uid);
$text .= user_view($account, 'department_search_result');
}
return $text;
}