Drupal:如何删除“编辑”选项在某些条件下节点的选项卡?
我有一个节点表单,作者应该能够编辑它,除非满足某些条件。我想为作者删除这些条件下的“编辑”选项卡。高级用户应该仍然能够使用“编辑”选项卡。
hook_menu_alter()
函数对我不起作用,因为它只有在菜单构建时才会被调用,然后才会被放入缓存中。
我更愿意(a)在不添加另一个 contrib 模块的情况下执行此操作,以及(b)在模块级别而不是主题级别(为了安全性),但我也有兴趣听到其他方法。
I have a node form that the author should be able to edit, unless certain conditions are true. I would like to remove the "Edit" tab under those conditions, for the author. Power users should still be able to use the "Edit" tab.
The hook_menu_alter()
function doesn't work for me because it only gets called when the menu gets built, before it is put into cache.
I would prefer to (a) do this without adding another contrib module and (b) at the module level, instead of the theme level (for security), but am interested in hearing other ways as well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能可以使用 规则 来执行此操作,但我个人会使用
hook_node_access()
在自定义模块:You can probably use Rules to do this but personally I'd use
hook_node_access()
in a custom module: