diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php index 2ce81a5..44d730f 100644 --- a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php +++ b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php @@ -98,9 +98,10 @@ public function buildForm(array $form, array &$form_state) { ); foreach ($uninstallable as $module) { + $module_name = $module->info['name'] ?: $module->name; - $form['modules'][$module->name]['checkbox'] = array( + $form['modules'][$module->name]['uninstall']['checkbox'] = array( '#type' => 'checkbox', '#title' => $this->t('Uninstall @module module', array('@module' => $module_name)), '#title_display' => 'invisible', @@ -109,14 +110,16 @@ public function buildForm(array $form, array &$form_state) { // All modules which depend on this one must be uninstalled first, before // we can allow this module to be uninstalled. (The installation profile // is excluded from this list.) + $required_by = array(); foreach (array_keys($module->required_by) as $dependent) { if ($dependent != $profile && drupal_get_installed_schema_version($dependent) != SCHEMA_UNINSTALLED) { $name = isset($modules[$dependent]->info['name']) ? $modules[$dependent]->info['name'] : $dependent; $required_by[] = $name; - $form['modules'][$module->name]['checkbox']['#disabled'] = TRUE; + $form['modules'][$module->name]['uninstall']['checkbox']['#disabled'] = TRUE; } } + $form['modules'][$module->name]['name'] = array( '#markup' => '' . $module_name . '', ); @@ -133,7 +136,8 @@ public function buildForm(array $form, array &$form_state) { $disabled_message = '
' . $disabled_message . '
'; } $form['modules'][$module->name]['description']['#markup'] = $this->t($module->info['description']) . $disabled_message; - } + + } $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( @@ -152,19 +156,18 @@ public function validateForm(array &$form, array &$form_state) { $modules = $form_state['values']['modules']; $selected_modules = array(); foreach ($modules as $module_name => $input) { - if ($input['checkbox']) { + if ($input['uninstall']['checkbox']) { $selected_modules[] = $module_name; } } + $form_state['values']['selected_modules'] = $selected_modules; + // Form submitted, but no modules selected. if (!$selected_modules) { drupal_set_message($this->t('No modules selected.'), 'error'); $form_state['redirect_route']['route_name'] = 'system.modules_uninstall'; } - else { - $form_state['values']['selected_modules'] = $selected_modules; - } } /**