如何在 hook_form_alter 上添加权重
我的模块中有一个 hook_form_alter,但另一个模块 workbench_access 也有一个 hook_form_alter,我需要在 hook_form_alter 之前调用它。如何为我的 hook_form_alter 添加权重?
I have a hook_form_alter in my module, but another module, workbench_access, also has a hook_form_alter which I need to be called before my hook_form_alter. How do I add weight to my hook_form_alter?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您只需将
system
表中模块的weight
列设置为高于 Workbench Access 模块的值即可。请参阅如何更新模块的权重了解执行此操作的不同方法。一旦完成,清除 Drupal 的缓存,您的模块的钩子将在 Workbench Access 模块(很可能还有许多其他模块)的钩子之后被调用。
You just need to set the
weight
column for your module in thesystem
table to higher than that of the Workbench Access module.See How to update a module's weight for the different ways to do this. Once you have, clear Drupal's caches and your module's hooks will be called after those of Workbench Access modules (and most likely a lot of other modules).