Home ›
Include a file nested within a module directory wit Drupal 7's module_load_includeInclude a file nested within a module directory wit Drupal 7's module_load_include
Submitted by Benjamin Melançon on May 5, 2012 - 4:57am
The documentation for module_load_include doesn't mention it, but if a file is in a subdirectory in its module folder, or even nested several levels deeper, this module-relative path should be included with the file name in the third parameter.
<?php
module_load_include('inc', 'page_manager', 'plugins/tasks/node_view');
?>
Note that this is module-relative, not project-relative. For instance, in the example above page_manager is in the ctools project.
Comments
Post new comment