diff --git a/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/core/lib/Drupal/Core/Extension/ModuleInstaller.php index e523943..ef63b04 100644 --- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php +++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php @@ -330,7 +330,7 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) { foreach ($reasons as $reason) { $reason_message[] = implode(', ', $reason); } - throw new ModuleUninstallValidatorException(format_string('The following reasons prevents the modules from being uninstalled: @reasons', array( + throw new ModuleUninstallValidatorException(format_string('The following reasons prevent the modules from being uninstalled: @reasons', array( '@reasons' => implode('; ', $reason_message), ))); } diff --git a/core/modules/system/css/system.admin.css b/core/modules/system/css/system.admin.css index 1dd5da9..b4af1d0 100644 --- a/core/modules/system/css/system.admin.css +++ b/core/modules/system/css/system.admin.css @@ -157,7 +157,8 @@ small .admin-link:after { margin-bottom: 0; } .admin-requirements, -.admin-required { +.admin-required, +.validation-reasons { font-size: 0.9em; color: #666; } diff --git a/core/modules/system/src/Form/ModulesUninstallForm.php b/core/modules/system/src/Form/ModulesUninstallForm.php index f72fa43..6799708 100644 --- a/core/modules/system/src/Form/ModulesUninstallForm.php +++ b/core/modules/system/src/Form/ModulesUninstallForm.php @@ -7,6 +7,7 @@ namespace Drupal\system\Form; +use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Extension\ModuleInstallerInterface; use Drupal\Core\Form\FormBase; @@ -110,7 +111,23 @@ public function buildForm(array $form, FormStateInterface $form_state) { ), ); - $form['modules'] = array(); + $profile = drupal_get_profile(); + + // Sort all modules by their name. + if (!empty($uninstallable)) { + uasort($uninstallable, 'system_sort_modules_by_info_name'); + $validation_reasons = $this->moduleInstaller->validateUninstall(array_keys($uninstallable)); + } + + $form['uninstall'] = [ + '#type' => 'table', + '#header' => [ + 'title' => ['data' => $this->t('Name')], + 'description' => ['data' => $this->t('Description')], + ], + '#empty' => $this->t('There are no items available to uninstall.'), + '#tableselect' => TRUE, + ]; // Only build the rest of the form if there are any modules available to // uninstall; @@ -118,41 +135,51 @@ public function buildForm(array $form, FormStateInterface $form_state) { return $form; } - $profile = drupal_get_profile(); - - // Sort all modules by their name. - uasort($uninstallable, 'system_sort_modules_by_info_name'); - $validation_reasons = $this->moduleInstaller->validateUninstall(array_keys($uninstallable)); - - $form['uninstall'] = array('#tree' => TRUE); foreach ($uninstallable as $module_key => $module) { - $name = $module->info['name'] ?: $module->getName(); - $form['modules'][$module->getName()]['#module_name'] = $name; - $form['modules'][$module->getName()]['name']['#markup'] = $name; - $form['modules'][$module->getName()]['description']['#markup'] = $this->t($module->info['description']); + // Define