替换 Drupal 中的节点编辑菜单
如何更改(取消设置或添加)我的编辑
节点菜单中的新按钮?在这种情况下,我想禁用“设置”菜单并添加一个新菜单...我查看了 $form
和 $form_state
,但没有那里有运气。至少,我是这么认为的...
编辑
模块名称:出版物
安装:publication.install
文件:publication.module
function publication_menu_alter(&$items) {
unset($items['node/%node/edit']);
}
编辑2
function publication_menu() {
$items['node/add/fiche'] = array(
'title' => 'New linked fiche',
'type' => MENU_LOCAL_TASK
);
return $items;
}
编辑3 我想做的是允许我的用户向现有内容添加更多内容。所以他们不允许编辑当前内容,只能添加一些细节。所以我想,我删除edit
按钮并将其替换为add
按钮,并且add
按钮链接到他所在的页面可以创造更多的内容。就是这样 :)
How can I change (unset or add) a new button in my edit
-node menu? In this case, I would like to diable the 'Settings'-menu and add a new menu... I looked in the $form
and the $form_state
, but no luck there. At least, that's what I think...
EDIT
Module name: publication
Install: publication.install
File: publication.module
function publication_menu_alter(&$items) {
unset($items['node/%node/edit']);
}
EDIT 2
function publication_menu() {
$items['node/add/fiche'] = array(
'title' => 'New linked fiche',
'type' => MENU_LOCAL_TASK
);
return $items;
}
EDIT 3
What I'm trying to do is to allow my users to add some more content to existing content. So they are not allowed to edit the current content, only to add some details. So I thought, I delete the edit
-button and replace it with an add
-button and the add
-button links to a page where he can create more content. That's it :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用
hook_menu_alter
来取消设置菜单。以及用于定义新菜单的
hook_menu
。在你的情况下,我认为它应该是菜单类型MENU_LOCAL_TASK
因为你想添加一个新选项卡。不是吗?You should use
hook_menu_alter
to unset menu.And
hook_menu
for defining new one. In your case I believe it should be menu typeMENU_LOCAL_TASK
since you want to add a new tab. Isn't it?