W3cubDocs

/Drupal 8

public function ModuleHandler::__construct

public ModuleHandler::__construct($root, array $module_list = array(), CacheBackendInterface $cache_backend)

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 109

Class

ModuleHandler
Class that manages modules in a Drupal installation.

Namespace

Drupal\Core\Extension

Code

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

© 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::__construct/8.1.x