search_menu

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

Implementation of hook_menu().

Code

modules/search.module, line 149

<?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/wipe', 'title' => t('Clear index'),
      'callback' => 'search_wipe_confirm',
      'access' => user_access('administer search'),
      'type' => MENU_CALLBACK);
  }
  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.