1.20.x bootstrap.inc backdrop_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.:

File

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

Code

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

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

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

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

    return TRUE;
  }

  return FALSE;
}