function template_preprocess_search_results

template_preprocess_search_results(&$variables)

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 84
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'];
}

© 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!search!search.pages.inc/function/template_preprocess_search_results/7.x