protected function ModulesEnabledTrait::modulesEnabledConfirmationMessage in Drupal 10
Provides a confirmation message after modules have been enabled.
Parameters
string[] $modules: Enabled module names, keyed by machine names.
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::modulesEnabledConfirmationMessage()
- 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 38
Class
- ModulesEnabledTrait
- Provides helpers for enabling modules.
Namespace
Drupal\system\FormCode
protected function modulesEnabledConfirmationMessage(array $modules) : PluralTranslatableMarkup {
$machine_names = implode(',', array_keys($modules));
$url = Url::fromRoute('user.admin_permissions.module', [
'modules' => $machine_names,
]);
$module_names = implode(', ', array_values($modules));
$t_args = [
'%name' => $module_names,
'%names' => $module_names,
];
if ($url
->access($this
->currentUser())) {
return $this
->formatPlural(count($modules), 'Module %name has been enabled. Configure <a href=":link">related permissions</a>.', '@count modules have been enabled: %names. Configure <a href=":link">related permissions</a>.', $t_args + [
':link' => $url
->toString(),
]);
}
return $this
->formatPlural(count($modules), 'Module %name has been enabled.', '@count modules have been enabled: %names.', $t_args);
}