hook_search_info

Versions
mediamosa-21
hook_search_info()

Define a custom search type.

This hook allows a module to tell search.module that it wishes to perform searches on content it defines (custom node types, users, or comments for example) when a site search is performed.

In order for the search to do anything, your module must also implement hook_search_execute(), which is called when someone requests a search on your module's type of content. If you want to have your content indexed in the standard search index, your module should also implement hook_update_index(). If your search type has settings, you can implement hook_search_admin() to add them to the search settings page. You can also alter the display of your module's search results by implementing hook_search_page(). And you can use hook_form_FORM_ID_alter(), with FORM_ID set to 'search', to add fields to the search form. See node_form_search_form_alter() for an example.

Return value

Array with the optional keys 'title' for the tab title and 'path' for the path component after 'search/'. Both will default to the module name.

Related topics

Code

modules/search/search.api.php, line 38

<?php
function hook_search_info() {
  return array(
    'title' => 'Content',
    'path' => 'node',
  );
}
?>