function 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.

4 calls to drupal_load()
forum_uninstall in drupal/core/modules/forum/forum.install
Implements hook_uninstall().
LocaleUninstallTest::testUninstallProcess in drupal/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php
Check if the values of the Locale variables are correct after uninstall.
ScanDirectoryTest::testOptionCallback in drupal/core/modules/system/lib/Drupal/system/Tests/File/ScanDirectoryTest.php
Check that the callback function is called correctly.
simpletest_uninstall in drupal/core/modules/simpletest/simpletest.install
Implements hook_uninstall().

File

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

Code

function drupal_load($type, $name) {
  if ($type == 'module' && Drupal::moduleHandler()
    ->moduleExists($name)) {
    return Drupal::moduleHandler()
      ->load($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;
}