如何使我的 drupal 模块具有条件依赖关系?

发布于 2025-01-07 00:08:56 字数 99 浏览 3 评论 0原文

我正在尝试编写一个需要模块 a 或模块 b 的模块(不是两者都需要,尽管两者都可以)。它仅取决于 a 或 b。有没有办法将其放入 .info 文件或以编程方式强制执行此 OR 依赖项?

I'm trying to write a module that requires either module a or module b (not both, though having both is fine). It just dependent on a OR b. Is there a way to put this in the .info file or enforce this OR dependency programatically?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

去了角落 2025-01-14 00:08:56

您不能在任何当前版本的 Drupal 中本地使用,有一个讨论讨论添加 < .info 文件的 code>enhances[] 和 enhancedby[] 属性(以及其他一些新属性),但尚未将其放入核心中就我而言可以告诉。

如果您使用的是 Drupal 6,您可能会查看 Module Supports 模块,该模块是为了响应而创建的那个讨论。

如果您使用的是 Drupal 7,那么讨论可能会让您成功一半,如果没有的话,该页面上有一些补丁,至少会大致告诉您需要做什么来自己修补 Drupal 核心才能使其正常工作。

You can't natively in any current version of Drupal, there is a discussion here which talks about adding a enhances[] and enhancedby[] property for .info files (amongst a few other new properties), but it has not been put into core as far as I can tell.

If you're using Drupal 6 you might have a look at the Module Supports module which was created in response to that discussion.

If you're using Drupal 7 the discussion might get you half way there, and if not there are a few patches on that page that will at least show you roughly what you need to do to patch Drupal core yourself to do get it working.

牵你手 2025-01-14 00:08:56

我看到其他模块实现这一点的唯一方法是在安装模块后报告问题,并且不将模块包含为依赖项。我认为这类似于 ckeditor 或 jquery_ui 等模块,它们需要放置非 Drupal 代码才能正常运行。

The only way I've seen other modules implement this is by reporting problems after a module is installed and not including the modules as dependent. I would assume this would be similar to modules like ckeditor or jquery_ui which require non-drupal code to be put in place to operate properly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文