开发者

How to change the Drupal core module behavior?

开发者 https://www.devze.com 2023-02-13 18:12 出处:网络
How can I change the behavior of search_menu() hook, not changing the search.module code? I want to change it from:

How can I change the behavior of search_menu() hook, not changing the search.module code?

I want to change it from:

function search_menu() {
  //...
  foreach (module_implements('search') as $name) {
    $items['search/'. $name .'/%menu_tail'] = array(
      'title callback' => 'module_invoke',
      'title arguments' => array($name, 'search', 'name', TRUE),
      'page callback' => 'search_view',
      'page arguments' => array($name),
      'access callback' => '_search_menu',
      'access arguments' => array($name),
      'type' => MENU_LOCAL_TASK,
      'parent' => 'search',
      'file' => 'search.pages.inc',
    );
  }
  return $items;
}

to:

function search_menu() {
  //...
  foreach (module_implements('search') as $name) {
    $items['search/'. $name .'/%menu_tail'] = array(
      'title callback' => 'module_invoke',
      'title arguments' => array($name, 'search', 'name', TRUE),
      'page callback' => 'search_vi开发者_如何学编程ew',
      'page arguments' => array($name),
      'access callback' => '_search_menu',
      'access arguments' => array($name),
      'type' => MENU_CALLBACK,
      'parent' => 'search',
      'file' => 'search.pages.inc',
    );
  }
  return $items;
}

to hide tabs on search page.

Thanks!


Do not hack core. Check out hook_menu_alter instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号