function search_menu in Drupal 5
Same name and namespace in other branches
- 4 modules/search.module \search_menu()
- 6 modules/search/search.module \search_menu()
- 7 modules/search/search.module \search_menu()
Implementation of hook_menu().
File
- modules/
search/ search.module, line 138 - Enables site-wide keyword searching.
Code
function search_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'search',
'title' => t('Search'),
'callback' => 'search_view',
'access' => user_access('search content'),
'type' => MENU_SUGGESTED_ITEM,
);
$items[] = array(
'path' => 'admin/settings/search',
'title' => t('Search settings'),
'description' => t('Configure relevance settings for search and other indexing options'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'search_admin_settings',
),
'access' => user_access('administer search'),
'type' => MENU_NORMAL_ITEM,
);
$items[] = array(
'path' => 'admin/settings/search/wipe',
'title' => t('Clear index'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'search_wipe_confirm',
),
'access' => user_access('administer search'),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'admin/logs/search',
'title' => t('Top search phrases'),
'description' => t('View most popular search phrases.'),
'callback' => 'watchdog_top',
'callback arguments' => array(
'search',
),
);
}
else {
if (arg(0) == 'search') {
// To remember the user's search keywords when switching across tabs,
// we dynamically add the keywords to the search tabs' paths.
$keys = search_get_keys();
$keys = strlen($keys) ? '/' . $keys : '';
foreach (module_list() as $name) {
if (module_hook($name, 'search') && ($title = module_invoke($name, 'search', 'name'))) {
$items[] = array(
'path' => 'search/' . $name . $keys,
'title' => $title,
'callback' => 'search_view',
'access' => user_access('search content'),
'type' => MENU_LOCAL_TASK,
);
}
}
}
}
return $items;
}