hook_search_info
- Versions
- 7
hook_search_info()
Define a custom search routine.
This hook allows a module to perform searches on content it defines (custom node types, users, or comments, for example) when a site search is performed.
Note that you can use form API to extend the search. You will need to use hook_form_alter() to add any additional required form elements. You can process their values on submission using a custom validation function. You will need to merge any custom search values into the search keys using a key:value syntax. This allows all search queries to have a clean and permanent URL. See node_form_search_form_alter() for an example.
The example given here is for node.module, which uses the indexed search capabilities. To do this, node module also implements hook_update_index() which is used to create and maintain the index.
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',
);
}
?>Login or register to post comments 