drupal_load

Versions
4.6 – 7
drupal_load($type, $name)

Includes a file with the provided type and name. This prevents including a theme, engine, module, etc., more than once.

Parameters

$type The type of item to load (i.e. theme, theme_engine, module).

$name The name of the item to load.

Return value

TRUE if the item is loaded or has already been loaded.

▾ 9 functions call drupal_load()

bootstrap_invoke_all in includes/bootstrap.inc
Call all init or exit hooks without including all modules.
drupal_uninstall_modules in includes/install.inc
Calls the uninstall function and updates the system table for a given module.
field_sql_storage_schema in modules/field/modules/field_sql_storage/field_sql_storage.install
Implement hook_schema().
forum_uninstall in modules/forum/forum.install
Implement hook_uninstall().
hook_boot in modules/system/system.api.php
Perform setup tasks. See also, hook_init.
module_enable in includes/module.inc
Enable a given list of modules.
module_load_all in includes/module.inc
Load all the modules that have been enabled in the system table.
_drupal_install_module in includes/install.inc
Callback to install an individual install profile module.
_drupal_maintenance_theme in includes/theme.maintenance.inc
Sets up the theming system for site installs, updates and when the site is in maintenance mode. It also applies when the database is unavailable.

Code

includes/bootstrap.inc, line 852

<?php
function drupal_load($type, $name) {
  // Once a file is included this can't be reversed during a request so do not
  // use drupal_static() here.
  static $files = array();

  if (isset($files[$type][$name])) {
    return TRUE;
  }

  $filename = drupal_get_filename($type, $name);

  if ($filename) {
    include_once DRUPAL_ROOT . '/' . $filename;
    $files[$type][$name] = TRUE;

    return TRUE;
  }

  return FALSE;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.