protected function ModuleExtensionList::doList in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Extension/ModuleExtensionList.php \Drupal\Core\Extension\ModuleExtensionList::doList()
- 10 core/lib/Drupal/Core/Extension/ModuleExtensionList.php \Drupal\Core\Extension\ModuleExtensionList::doList()
Builds the list of extensions.
Return value
\Drupal\Core\Extension\Extension[] Processed extension objects, keyed by machine name.
Throws
\Drupal\Core\Extension\InfoParserException If one of the .info.yml files is incomplete, or causes a parsing error.
Overrides ExtensionList::doList
File
- core/
lib/ Drupal/ Core/ Extension/ ModuleExtensionList.php, line 152
Class
- ModuleExtensionList
- Provides a list of available modules.
Namespace
Drupal\Core\ExtensionCode
protected function doList() {
// Find modules.
$extensions = parent::doList();
// It is possible that a module was marked as required by
// hook_system_info_alter() and modules that it depends on are not required.
foreach ($extensions as $extension) {
$this
->ensureRequiredDependencies($extension, $extensions);
}
// Add status, weight, and schema version.
$installed_modules = $this->configFactory
->get('core.extension')
->get('module') ?: [];
foreach ($extensions as $name => $module) {
$module->weight = isset($installed_modules[$name]) ? $installed_modules[$name] : 0;
$module->status = (int) isset($installed_modules[$name]);
$module->schema_version = SCHEMA_UNINSTALLED;
}
$extensions = $this->moduleHandler
->buildModuleDependencies($extensions);
if ($this->installProfile && $extensions[$this->installProfile]) {
$active_profile = $extensions[$this->installProfile];
// Installation profile hooks are always executed last.
$active_profile->weight = 1000;
// Installation profiles are hidden by default, unless explicitly
// specified otherwise in the .info.yml file.
if (!isset($active_profile->info['hidden'])) {
$active_profile->info['hidden'] = TRUE;
}
// The installation profile is required.
$active_profile->info['required'] = TRUE;
// Add a default distribution name if the profile did not provide one.
// @see install_profile_info()
// @see drupal_install_profile_distribution_name()
if (!isset($active_profile->info['distribution']['name'])) {
$active_profile->info['distribution']['name'] = 'Drupal';
}
}
return $extensions;
}