protected function ModulesEnabledTrait::modulesFailToEnableMessage in Drupal 10
Provides a fail message after attempt to install a module.
Parameters
string[] $modules: Enabled module names, keyed by machine names.
Drupal\Core\Config\PreExistingConfigException $exception: Exception thrown if configuration with the same name already exists.
Return value
\Drupal\Core\StringTranslation\PluralTranslatableMarkup A confirmation message. If any of the enabled modules have permissions that the current user can manage, then include a link to the permissions page for those modules.
2 calls to ModulesEnabledTrait::modulesFailToEnableMessage()
- ModulesListConfirmForm::submitForm in core/
modules/ system/ src/ Form/ ModulesListConfirmForm.php - Form submission handler.
- ModulesListForm::submitForm in core/
modules/ system/ src/ Form/ ModulesListForm.php - Form submission handler.
File
- core/
modules/ system/ src/ Form/ ModulesEnabledTrait.php, line 74
Class
- ModulesEnabledTrait
- Provides helpers for enabling modules.
Namespace
Drupal\system\FormCode
protected function modulesFailToEnableMessage(array $modules, PreExistingConfigException $exception) : PluralTranslatableMarkup {
$config_objects = $exception
->flattenConfigObjects($exception
->getConfigObjects());
return $this
->formatPlural(count($config_objects), 'Unable to install @extension, %config_names already exists in active configuration.', 'Unable to install @extension, %config_names already exist in active configuration.', [
'%config_names' => implode(', ', $config_objects),
'@extension' => $modules['install'][$exception
->getExtension()],
]);
}