search_menu

Versions
4.6 – 5
search_menu($may_cache)
6 – 7
search_menu()

Implementation of hook_menu().

Code

modules/search/search.module, line 138

<?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;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.