diff -u b/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc --- b/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -279,10 +279,18 @@ /** * Prepares variables for the module uninstall template. * - * @todo * @param $variables * An associative array containing: - * - form: A render element representing the form. + * - form: A render element representing the form. Child elements of the form + * are individual modules. Each module is an associative array containing + * the following elements: + * - #module_name: The name of the module as a string. + * - name: The name of the module in a renderable array. + * - description: A description of the module. + * - #required_by: (optional) A list of modules that require the module. + * - #validation_reasons: (optional) Additional reasons why the module + * cannot be disabled. + * - #attributes: A list of attributes for the module wrapper. * * @ingroup themeable */ @@ -292,25 +300,25 @@ $variables['empty'] = t('No modules are available to uninstall.'); - // Table headers. - $variables['header'] = array( - 'uninstall' => t('Uninstall'), - 'name' => t('Name'), - 'description' => t('Description'), - ); - - // No theming for the confirm form. - if (isset($form['confirm'])) { - return drupal_render($form); - } - // Iterate through all the modules, which are children of this element. foreach (Element::children($form['modules']) as $key) { $module = $form['modules'][$key]; - + $module['plain_name'] = $module['#module_name']; $module['checkbox'] = $form['uninstall'][$key]; $module['checkbox_id'] = $form['uninstall'][$key]['#id']; + if (!empty($module['#validation_reasons'])) { + $module['validation_reasons'] = $module['#validation_reasons']; + $module['reasons_count'] = count($module['validation_reasons']); + } else { + $module['reasons_count'] = 0; + } + if (!empty($module['#required_by'])) { + $module['required_by'] = $module['#required_by']; + $module['reasons_count'] = $module['reasons_count'] + 1; + } +/* + krumo($module); // Add the modules requiring the module in question as a validation reason. if (!empty($module['#required_by'])) { $module['#validation_reasons'][] = \Drupal::translation() @@ -321,12 +329,8 @@ '#theme' => 'item_list', '#items' => $module['#validation_reasons'], ]; - $module['disabled_header'] = \Drupal::translation()->formatPlural(count($module['#validation_reasons']), - 'The following reason prevents @module from being uninstalled:', - 'The following reasons prevents @module from being uninstalled:', - array('@module' => $module['#module_name'])); - } + }*/ $module['attributes'] = new Attribute($module['#attributes']); $variables['modules'][] = $module; } diff -u b/core/modules/system/templates/system-modules-uninstall.html.twig b/core/modules/system/templates/system-modules-uninstall.html.twig --- b/core/modules/system/templates/system-modules-uninstall.html.twig +++ b/core/modules/system/templates/system-modules-uninstall.html.twig @@ -4,23 +4,14 @@ * Default theme implementation for the modules uninstall page. * * Available variables: - * - form: - * - filters: - * - actions: - * - header: Table header containing the following cells: - * - uninstall: A localized string for the title of the 'uninstall' column. - * - name: A localized string for the title of the 'name' column. - * - description: A localized string for the title of the 'description' - * column. + * - form: The modules uninstall form. * - modules: Contains multiple module instances. Each module contains: * - attributes: Attributes on the row. + * - plain_name: The plain-text name of the module. * - checkbox: A checkbox for uninstalling the module. + * - checkbox_id: A unique id for interacting with the checkbox element. * - name: The human-readable name of the module. - * - id: A unqiue id for interacting with the details element. - * - uninstall_id: A unique id for interacting with the checkbox element. * - description: The description of the module. - * - machine_name: The module's machine name. - * - disabled_header: (optional) A localized string for . * - disabled_reasons: (optional) A list of reasons why this module cannot be * uninstalled. * @@ -36,13 +27,13 @@ - {{ header.uninstall }} + {{ 'Uninstall'|t }} - {{ header.name }} + {{ 'Name'|t }} - {{ header.description }} + {{ 'Description'|t }} @@ -57,8 +48,24 @@ {{ module.description }} - {% if module.disabled_header is not empty %} -
{{ module.disabled_header }}{{ module.disabled_reasons }}
+ {% if module.reasons_count > 0 %} +
+ {% trans %} + The following reason prevents {{ module.plain_name }} from being uninstalled: + {% plural module.reasons_count %} + The following reasons prevent {{ module.plain_name }} from being uninstalled: + {% endtrans %} +
+ +
+
{% endif %} @@ -73,5 +80,5 @@ {{ form|without( - 'filters', - 'modules', - 'uninstall' + 'filters', + 'modules', + 'uninstall' ) }}