search_menu
modules/search/search.module, строка 138
- Версии
- 5
search_menu(
$may_cache)- 6
search_menu()
Реализация hook_menu()
.
Код
<?php
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;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии