You are here

function template_preprocess_search_results in Drupal 7

Same name and namespace in other branches
  1. 6 modules/search/search.pages.inc \template_preprocess_search_results()

Process variables for search-results.tpl.php.

The $variables array contains the following arguments:

  • $results: Search results array.
  • $module: Module the search results came from (module implementing hook_search_info()).

See also

search-results.tpl.php

File

modules/search/search.pages.inc, line 85
User page callbacks for the search module.

Code

function template_preprocess_search_results(&$variables) {
  $variables['search_results'] = '';
  if (!empty($variables['module'])) {
    $variables['module'] = check_plain($variables['module']);
  }
  foreach ($variables['results'] as $result) {
    $variables['search_results'] .= theme('search_result', array(
      'result' => $result,
      'module' => $variables['module'],
    ));
  }
  $variables['pager'] = theme('pager', array(
    'tags' => NULL,
  ));
  $variables['theme_hook_suggestions'][] = 'search_results__' . $variables['module'];
}