ModuleHandler::load

public ModuleHandler::load($name)

Includes a module's .module file.

This prevents including a module more than once.

Parameters

string $name: The name of the module to load.

Return value

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

Overrides ModuleHandlerInterface::load

File

core/lib/Drupal/Core/Extension/ModuleHandler.php, line 121

Class

ModuleHandler
Class that manages modules in a Drupal installation.

Namespace

Drupal\Core\Extension

Code

1
2
3
4
5
6
7
8
9
10
11
12
public function load($name) {
  if (isset($this->loadedFiles[$name])) {
    return TRUE;
  }
 
  if (isset($this->moduleList[$name])) {
    $this->moduleList[$name]->load();
    $this->loadedFiles[$name] = TRUE;
    return TRUE;
  }
  return FALSE;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.