如何改变Drupal核心模块的行为?
如何更改 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;
}
以隐藏搜索页面上的选项卡。
谢谢!
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_view',
'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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要破解核心。请查看 hook_menu_alter 。
Do not hack core. Check out hook_menu_alter instead.