function ModuleHandler::add
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Extension/ModuleHandler.php \Drupal\Core\Extension\ModuleHandler::add()
- 10 core/lib/Drupal/Core/Extension/ModuleHandler.php \Drupal\Core\Extension\ModuleHandler::add()
- 11.x core/lib/Drupal/Core/Extension/ModuleHandler.php \Drupal\Core\Extension\ModuleHandler::add()
Adds a module or profile to the list of currently active modules.
Parameters
string $type: The extension type; either 'module' or 'profile'.
string $name: The module name; e.g., 'node'.
string $path: The module path; e.g., 'core/modules/node'.
2 calls to ModuleHandler::add()
- ModuleHandler::addModule in core/
lib/ Drupal/ Core/ Extension/ ModuleHandler.php - Adds a module to the list of currently active modules.
- ModuleHandler::addProfile in core/
lib/ Drupal/ Core/ Extension/ ModuleHandler.php - Adds an installation profile to the list of currently active modules.
File
-
core/
lib/ Drupal/ Core/ Extension/ ModuleHandler.php, line 213
Class
- ModuleHandler
- Class that manages modules in a Drupal installation.
Namespace
Drupal\Core\ExtensionCode
protected function add($type, $name, $path) {
$pathname = "{$path}/{$name}.info.yml";
$filename = file_exists($this->root . "/{$path}/{$name}.{$type}") ? "{$name}.{$type}" : NULL;
$this->moduleList[$name] = new Extension($this->root, $type, $pathname, $filename);
$this->resetImplementations();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.