You are here

public function ModuleHandler::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Extension/ModuleHandler.php \Drupal\Core\Extension\ModuleHandler::__construct()

Constructs a ModuleHandler object.

Parameters

string $root: The app root.

array $module_list: An associative array whose keys are the names of installed modules and whose values are Extension class parameters. This is normally the %container.modules% parameter being set up by DrupalKernel.

\Drupal\Core\Cache\CacheBackendInterface $cache_backend: Cache backend for storing module hook implementation information.

See also

\Drupal\Core\DrupalKernel

\Drupal\Core\CoreServiceProvider

File

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

Class

ModuleHandler
Class that manages modules in a Drupal installation.

Namespace

Drupal\Core\Extension

Code

public function __construct($root, array $module_list, CacheBackendInterface $cache_backend) {
  $this->root = $root;
  $this->moduleList = [];
  foreach ($module_list as $name => $module) {
    $this->moduleList[$name] = new Extension($this->root, $module['type'], $module['pathname'], $module['filename']);
  }
  $this->cacheBackend = $cache_backend;
}