On this page
function install_profile_modules
install_profile_modules(&$install_state)
Installs required modules via a batch process.
Parameters
$install_state: An array of information about the current installation state.
Return value
The batch definition.
File
- core/includes/install.core.inc, line 1470
- API functions for installing Drupal.
Code
function install_profile_modules(&$install_state) {
// We need to manually trigger the installation of core-provided entity types,
// as those will not be handled by the module installer.
install_core_entity_type_definitions();
$modules = \Drupal::state()->get('install_profile_modules') ? : array();
$files = system_rebuild_module_data();
\Drupal::state()->delete('install_profile_modules');
// Always install required modules first. Respect the dependencies between
// the modules.
$required = array();
$non_required = array();
// Add modules that other modules depend on.
foreach ($modules as $module) {
if ($files[$module]->requires) {
$modules = array_merge($modules, array_keys($files[$module]->requires));
}
}
$modules = array_unique($modules);
foreach ($modules as $module) {
if (!empty($files[$module]->info['required'])) {
$required[$module] = $files[$module]->sort;
}
else {
$non_required[$module] = $files[$module]->sort;
}
}
arsort($required);
arsort($non_required);
$operations = array();
foreach ($required + $non_required as $module => $weight) {
$operations[] = array('_install_module_batch', array($module, $files[$module]->info['name']));
}
$batch = array(
'operations' => $operations,
'title' => t('Installing @drupal', array('@drupal' => drupal_install_profile_distribution_name())),
'error_message' => t('The installation has encountered an error.'),
);
return $batch;
}
© 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!includes!install.core.inc/function/install_profile_modules/8.1.x