You are here

function search_data in Drupal 7

Same name and namespace in other branches
  1. 4 modules/search.module \search_data()
  2. 5 modules/search/search.module \search_data()
  3. 6 modules/search/search.module \search_data()

Performs a search by calling hook_search_execute().

Parameters

$keys: Keyword query to search on.

$module: Search module to search.

$conditions: Optional array of additional search conditions.

Return value

Renderable array of search results. No return value if $keys are not supplied or if the given search module is not active.

Related topics

1 call to search_data()
search_view in modules/search/search.pages.inc
Menu callback; presents the search form and/or search results.

File

modules/search/search.module, line 1098
Enables site-wide keyword searching.

Code

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,
      );
    }
  }
}