Community Documentation

drupal_load

5 bootstrap.inc drupal_load($type, $name)
6 bootstrap.inc drupal_load($type, $name)
7 bootstrap.inc drupal_load($type, $name)
8 bootstrap.inc 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.

▾ 15 functions call drupal_load()

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.
install_begin_request in includes/install.core.inc
Begin an installation request, modifying the installation state as needed.
LocaleUILanguageNegotiationTest::setUp in modules/locale/locale.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
LocaleUninstallFunctionalTest::testUninstallProcess in modules/locale/locale.test
Check if the values of the Locale variables are correct after uninstall.
module_enable in includes/module.inc
Enables or installs a given list of modules.
module_load_all in includes/module.inc
Load all the modules that have been enabled in the system table.
SearchExcerptTestCase::setUp in modules/search/search.test
Sets up unit test environment.
SearchExpressionInsertExtractTestCase::setUp in modules/search/search.test
Sets up unit test environment.
shortcut_uninstall in modules/shortcut/shortcut.install
Implements hook_uninstall().
simpletest_uninstall in modules/simpletest/simpletest.install
Implements hook_uninstall().
UpgradePathTestCase::performUpgrade in modules/simpletest/tests/upgrade/upgrade.test
Perform the upgrade.
_drupal_maintenance_theme in includes/theme.maintenance.inc
Sets up the theming system for maintenance page.

File

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

Code

<?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