protected function ModuleHandler::add

protected ModuleHandler::add($type, $name, $path)

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

File

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

Class

ModuleHandler
Class that manages modules in a Drupal installation.

Namespace

Drupal\Core\Extension

Code

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();
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Extension!ModuleHandler.php/function/ModuleHandler::add/8.1.x