function 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

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.