0

In the docs:

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

name = Really Neat Widget
...
files[] = tests/example.test

When a module is enabled, Drupal will rescan all declared files and index all the classes and interfaces that it finds. Classes will be loaded automatically by PHP when they are first accessed.

But, it is posible to add a file fomr another module?

For example:

files[]: myothermodule/includes/file.inc

4
  • Short answer: no.
    – Jaypan
    Feb 14, 2017 at 15:27
  • I guessing that i have to use module_load_include whereever needed? Feb 14, 2017 at 15:31
  • You got it! It's more lightweight that way anyways.
    – Jaypan
    Feb 14, 2017 at 15:34
  • I believe that you should also add the module as a dependency in your module's .info file or check if module_exists before accessing the file/function/class.
    – SpartyDan
    Feb 14, 2017 at 15:45

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.