function ModuleExtensionList::ensureRequiredDependencies
Same name in other branches
- 9 core/lib/Drupal/Core/Extension/ModuleExtensionList.php \Drupal\Core\Extension\ModuleExtensionList::ensureRequiredDependencies()
- 8.9.x core/lib/Drupal/Core/Extension/ModuleExtensionList.php \Drupal\Core\Extension\ModuleExtensionList::ensureRequiredDependencies()
- 10 core/lib/Drupal/Core/Extension/ModuleExtensionList.php \Drupal\Core\Extension\ModuleExtensionList::ensureRequiredDependencies()
Marks dependencies of required modules as 'required', recursively.
Parameters
\Drupal\Core\Extension\Extension $module: The module extension object.
\Drupal\Core\Extension\Extension[] $modules: Extension objects for all available modules.
1 call to ModuleExtensionList::ensureRequiredDependencies()
- ModuleExtensionList::doList in core/
lib/ Drupal/ Core/ Extension/ ModuleExtensionList.php
File
-
core/
lib/ Drupal/ Core/ Extension/ ModuleExtensionList.php, line 209
Class
- ModuleExtensionList
- Provides a list of available modules.
Namespace
Drupal\Core\ExtensionCode
protected function ensureRequiredDependencies(Extension $module, array $modules = []) {
if (!empty($module->info['required'])) {
foreach ($module->info['dependencies'] as $dependency) {
$dependency_name = Dependency::createFromString($dependency)->getName();
if (!isset($modules[$dependency_name]->info['required'])) {
$modules[$dependency_name]->info['required'] = TRUE;
$modules[$dependency_name]->info['explanation'] = $this->t('Dependency of required module @module', [
'@module' => $module->info['name'],
]);
// Ensure any dependencies it has are required.
$this->ensureRequiredDependencies($modules[$dependency_name], $modules);
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.