drupal - .info 中的 files[] 的用途是什么?

标签 drupal drupal-7 drupal-modules

我刚刚开始学习发现 Drupal 7 的更改,并且我刚刚发现 mymodule.info 中现在需要 files[] 数组。根据我的发现,需要将 mymodule.module 文件添加到列表中,但它还有什么其他用途?

根据我读到的内容,我认为我应该能够将代码分成几个文件,例如我想创建一个 mymodule.blocks.inc 来包含我的 block 的所有代码,但似乎 mymodule_block_info() 函数从未运行。

我做错了什么,还是这不是它应该使用的方式?

最佳答案

作为documentation说:

files (Optional) Drupal now supports a dynamic-loading code registry. To support it, all modules must now declare any code files containing class or interface declarations in the .info file.

仅当您在 files[] 中指定的文件包含类或接口(interface)时才使用此选项。如果是这样,该文件将仅在需要时自动加载。
不应使用 files[] 声明其他文件。

关于drupal - .info 中的 files[] 的用途是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7159037/

相关文章:

mysql - 由于转换记录 : 失败,请求回滚字段 "field_images"

php - 德鲁帕尔 7 : Sharing authentication with HTTP-Auth

drupal-7 - fatal error : require_once() with module . 安装文件,drupal 7

drupal - 如何获取和设置增量值?

Drupal 6 View 。如何使 View 标题成为节点 id 参数的节点标题?

css - Drupal View 中 block 和页面的自定义 CSS

performance - 为什么提供缓存页面需要一秒钟?

php - Xampp 服务器 MySQL 错误? MySQL 数据库的状态 - DEACTIVATED

css - Drupal 模块 CSS 字符调整

德鲁帕尔 6 : Parent menu item redirection to first submenu item