diff --git a/core/modules/system/src/Form/ModulesUninstallForm.php b/core/modules/system/src/Form/ModulesUninstallForm.php index 360dbf9..ec1a0ea 100644 --- a/core/modules/system/src/Form/ModulesUninstallForm.php +++ b/core/modules/system/src/Form/ModulesUninstallForm.php @@ -149,7 +149,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { // If a validator returns reasons not to uninstall a module, // list the reasons and disable the check box. if (isset($validation_reasons[$module_key])) { - $form['modules'][$module->getName()]['#validation_reasons'] = $validation_reasons[$module_key]; $form['uninstall'][$module->getName()]['#disabled'] = TRUE; } // All modules which depend on this one must be uninstalled first, before @@ -173,6 +172,14 @@ public function buildForm(array $form, FormStateInterface $form_state) { else { $disabled_message = ''; } + if (isset($validation_reasons[$module_key])) { + $disabled_message = \Drupal::translation()->formatPlural(count($validation_reasons[$module_key]), + 'The following reason prevents @module from being uninstalled: @reasons', + 'The following reasons prevents @module from being uninstalled: @reasons', + array('@module' => $module->getName(), '@reasons' => implode('; ', $validation_reasons[$module_key]))); + $disabled_message .= '
' . $disabled_message . '
'; + } + $form['uninstall'][$module->getName()]['description']['uninstall']['#markup'] = $this->t($disabled_message); } diff --git a/core/modules/system/src/Tests/Module/UninstallTest.php b/core/modules/system/src/Tests/Module/UninstallTest.php index aa06bda..9078d94 100644 --- a/core/modules/system/src/Tests/Module/UninstallTest.php +++ b/core/modules/system/src/Tests/Module/UninstallTest.php @@ -54,7 +54,7 @@ function testUninstallPage() { $this->drupalGet('admin/modules/uninstall'); $this->assertTitle(t('Uninstall') . ' | Drupal'); - $this->assertText(\Drupal::translation()->translate('The following reasons prevents Node from being uninstalled: There is content for the entity type: Content'), 'Content prevents uninstalling node module.'); + $this->assertText('The following reason prevents Node from being uninstalled: There is content for the entity type: Content', 'Content prevents uninstalling node module.'); // Delete the node to allow node to be uninstalled. $node->delete(); $node_type->delete();