| Versions | |
|---|---|
| 4.7 – 6 | search_data($keys = NULL, |
| 7 | search_data($keys, $module, $conditions = NULL) |
Performs a search by calling hook_search_execute().
$keys Keyword query to search on.
$module Search module to search.
$conditions Optional array of additional search conditions.
Renderable array of search results. No return value if $keys are not supplied or if the given search module is not active.
drupal/
<?php
function search_data($keys, $module, $conditions = NULL) {
if (module_hook($module, 'search_execute')) {
$results = module_invoke($module, 'search_execute', $keys, $conditions);
if (module_hook($module, 'search_page')) {
return module_invoke($module, 'search_page', $results);
}
else {
return array(
'#theme' => 'search_results',
'#results' => $results,
'#module' => $module,
);
}
}
}
?>