Same name and namespace in other branches
  1. 10 core/includes/module.inc \module_load_include()
  2. 7.x includes/module.inc \module_load_include()
  3. 8.9.x core/includes/module.inc \module_load_include()
  4. 9 core/includes/module.inc \module_load_include()

Load a module include file.

Examples:

// Load node.admin.inc from the node module.
module_load_include('inc', 'node', 'node.admin');

// Load content_types.inc from the node module.
module_load_include('inc', 'node', 'content_types');

Do not use this function to load an install file. Use module_load_install() instead.

Parameters

$type: The include file's type (file extension).

$module: The module to which the include file belongs.

$name: Optionally, specify the base file name (without the $type extension). If not set, $module is used.

16 calls to module_load_include()
forum_overview in modules/forum/forum.admin.inc
Returns an overview list of existing forums and containers
module_load_all_includes in includes/module.inc
Load an include file for each of the modules that have been enabled in the system table.
module_load_install in includes/module.inc
Load a module's installation hooks.
openid_association in modules/openid/openid.module
Attempt to create a shared secret with the OpenID Provider.
openid_association_request in modules/openid/openid.module

... See full list

File

includes/module.inc, line 280
API for loading and interacting with Drupal modules.

Code

function module_load_include($type, $module, $name = NULL) {
  if (empty($name)) {
    $name = $module;
  }
  $file = './' . drupal_get_path('module', $module) . "/{$name}.{$type}";
  if (is_file($file)) {
    require_once $file;
  }
  else {
    return FALSE;
  }
}