function ModuleExtensionList::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/Extension/ModuleExtensionList.php \Drupal\Core\Extension\ModuleExtensionList::__construct()
  2. 8.9.x core/lib/Drupal/Core/Extension/ModuleExtensionList.php \Drupal\Core\Extension\ModuleExtensionList::__construct()
  3. 11.x core/lib/Drupal/Core/Extension/ModuleExtensionList.php \Drupal\Core\Extension\ModuleExtensionList::__construct()

Constructs a new ModuleExtensionList instance.

Parameters

string $root: The app root.

string $type: The extension type.

\Drupal\Core\Cache\CacheBackendInterface $cache: The cache.

\Drupal\Core\Extension\InfoParserInterface $info_parser: The info parser.

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler.

\Drupal\Core\State\StateInterface $state: The state.

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory.

\Drupal\Core\Extension\ExtensionList $profile_list: The site profile listing.

string $install_profile: The install profile used by the site.

array[] $container_modules_info: (optional) The module locations coming from the compiled container.

Overrides ExtensionList::__construct

File

core/lib/Drupal/Core/Extension/ModuleExtensionList.php, line 73

Class

ModuleExtensionList
Provides a list of available modules.

Namespace

Drupal\Core\Extension

Code

public function __construct($root, $type, CacheBackendInterface $cache, InfoParserInterface $info_parser, ModuleHandlerInterface $module_handler, StateInterface $state, ConfigFactoryInterface $config_factory, ExtensionList $profile_list, $install_profile, array $container_modules_info = []) {
    parent::__construct($root, $type, $cache, $info_parser, $module_handler, $state, $install_profile);
    $this->configFactory = $config_factory;
    $this->profileList = $profile_list;
    // Use the information from the container. This is an optimization.
    foreach ($container_modules_info as $module_name => $info) {
        $this->setPathname($module_name, $info['pathname']);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.