How to change the Drupal core module behavior?
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.
精彩评论