You are here

function drupal_load in Drupal 7

Same name and namespace in other branches
  1. 4 includes/bootstrap.inc \drupal_load()
  2. 5 includes/bootstrap.inc \drupal_load()
  3. 6 includes/bootstrap.inc \drupal_load()

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.

16 calls to drupal_load()
authorize.php in ./authorize.php
Administrative script for running authorized file operations.
bootstrap_invoke_all in includes/bootstrap.inc
Invokes a bootstrap hook in all bootstrap modules that implement it.
field_sql_storage_schema in modules/field/modules/field_sql_storage/field_sql_storage.install
Implements hook_schema().
forum_uninstall in modules/forum/forum.install
Implements hook_uninstall().
hook_boot in modules/system/system.api.php
Perform setup tasks for all page requests.

... See full list

File

includes/bootstrap.inc, line 1377
Functions that need to be loaded on every Drupal request.

Code

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;
}