function hook_search_page

Same name and namespace in other branches
  1. 7.x drupal-7.x/modules/search/search.api.php \hook_search_page()

Override the rendering of search results.

A module that implements hook_search() to define a type of search may implement this hook in order to override the default theming of its search results, which is otherwise themed using theme('search_results').

Note that by default, theme('search_results') and theme('search_result') work together to create a definition list. So your hook_search_page() implementation should probably do this as well.

Parameters

$results: An array of search results.

Return value

An HTML string containing the formatted search results, with a pager included.

See also

search-result.tpl.php

search-results.tpl.php

Related topics

1 invocation of hook_search_page()
search_data in drupal-6.x/modules/search/search.module
Perform a standard search on the given keys, and return the formatted results.

Archivo

documentation-6.x/developer/hooks/core.php, line 2050
These are the hooks that are invoked by the Drupal core.

Código

function hook_search_page($results) {
  $output = '<dl class="search-results">';

  foreach ($results as $entry) {
    $output .= theme('search_result', $entry, $type);
  }
  $output .= '</dl>';
  $output .= theme('pager', NULL);

  return $output;
}