function install_recipe_required_modules
Same name in other branches
- 10 core/includes/install.core.inc \install_recipe_required_modules()
Installs required modules prior to applying a recipe via the installer.
@internal All installer code is internal.
See also
File
-
core/
includes/ install.core.inc, line 2577
Code
function install_recipe_required_modules() {
// We need to manually trigger the installation of core-provided entity types,
// as those will not be handled by the module installer.
// @see install_profile_modules()
install_core_entity_type_definitions();
$batch_builder = new BatchBuilder();
$batch_builder->setFinishCallback([
ConfigImporterBatch::class,
'finish',
])
->setTitle(t('Installing required modules'))
->setInitMessage(t('Starting required module installation.'))
->setErrorMessage(t('Required module installation has encountered an error.'));
$files = \Drupal::service('extension.list.module')->getList();
// Always install required modules first.
$required = [];
foreach ($files as $module => $extension) {
if (!empty($extension->info['required'])) {
$required[$module] = $extension->sort;
}
}
arsort($required);
// The system module is already installed. See install_base_system().
unset($required['system']);
foreach ($required as $module => $weight) {
$batch_builder->addOperation('_install_module_batch', [
$module,
$files[$module]->info['name'],
]);
}
return $batch_builder->toArray();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.