On this page
function drupal_verify_profile
drupal_verify_profile($install_state)
Verifies that all dependencies are met for a given installation profile.
Parameters
$install_state: An array of information about the current installation state.
Return value
The list of modules to install.
File
- core/includes/install.inc, line 557
- API functions for installing modules and themes.
Code
function drupal_verify_profile($install_state) {
$profile = $install_state['parameters']['profile'];
$info = $install_state['profile_info'];
// Get the list of available modules for the selected installation profile.
$listing = new ExtensionDiscovery(\Drupal::root());
$present_modules = array();
foreach ($listing->scan('module') as $present_module) {
$present_modules[] = $present_module->getName();
}
// The installation profile is also a module, which needs to be installed
// after all the other dependencies have been installed.
$present_modules[] = $profile;
// Verify that all of the profile's required modules are present.
$missing_modules = array_diff($info['dependencies'], $present_modules);
$requirements = array();
if ($missing_modules) {
$build = [
'#theme' => 'item_list',
'#context' => ['list_style' => 'comma-list'],
];
foreach ($missing_modules as $module) {
$build['#items'][] = array('#markup' => '<span class="admin-missing">' . Unicode::ucfirst($module) . '</span>');
}
$modules_list = \Drupal::service('renderer')->renderPlain($build);
$requirements['required_modules'] = array(
'title' => t('Required modules'),
'value' => t('Required modules not found.'),
'severity' => REQUIREMENT_ERROR,
'description' => t('The following modules are required but were not found. Move them into the appropriate modules subdirectory, such as <em>/modules</em>. Missing modules: @modules', array('@modules' => $modules_list)),
);
}
return $requirements;
}
© 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.inc/function/drupal_verify_profile/8.1.x