1

我怎样才能改变search_menu()钩子的行为,而不是改变search.module代码?

我想改变它:

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;
}

到:

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_CALLBACK,
      'parent' => 'search',
      'file' => 'search.pages.inc',
    );
  }
  return $items;
}

隐藏搜索页面上的标签。

谢谢!

4

1 回答 1

1

不要破解核心。改为查看hook_menu_alter

于 2011-02-28T16:50:08.053 回答