function _thunder_install_module_batch in Thunder 8.3
Same name and namespace in other branches
- 8.2 thunder.profile \_thunder_install_module_batch()
- 8.4 thunder.profile \_thunder_install_module_batch()
Implements callback_batch_operation().
Performs batch installation of modules.
1 string reference to '_thunder_install_module_batch'
- thunder_module_install in ./
thunder.profile - Installs the thunder modules in a batch.
File
- ./
thunder.profile, line 85 - Enables modules and site configuration for a thunder site installation.
Code
function _thunder_install_module_batch($module, $module_name, $form_values, &$context) {
set_time_limit(0);
$optionalModulesManager = \Drupal::service('plugin.manager.thunder.optional_modules');
try {
$definition = $optionalModulesManager
->getDefinition($module_name);
if ($definition['type'] == 'module') {
\Drupal::service('module_installer')
->install($module, TRUE);
}
elseif ($definition['type'] == 'theme') {
\Drupal::service('theme_installer')
->install($module, TRUE);
}
$instance = $optionalModulesManager
->createInstance($module_name);
$instance
->submitForm($form_values);
} catch (\Exception $e) {
}
$context['results'][] = $module;
$context['message'] = t('Installed %module_name modules.', [
'%module_name' => $module_name,
]);
}