diff --git a/core/modules/system/src/Tests/Form/ModulesListFormWebTest.php b/core/modules/system/src/Tests/Form/ModulesListFormWebTest.php
index 489f6ff..94c4656 100644
--- a/core/modules/system/src/Tests/Form/ModulesListFormWebTest.php
+++ b/core/modules/system/src/Tests/Form/ModulesListFormWebTest.php
@@ -49,6 +49,10 @@ public function testModuleListForm() {
// Check that system_test's help link was rendered correctly.
$this->assertFieldByXPath("//a[contains(@href, '/admin/help/system_test') and @title='Help']");
+
+ // Ensure that Testing modules machine name is printed. Testing module is
+ // used because its machine name is different than its human readable name.
+ $this->assertText('simpletest');
}
}
diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc
index 11b72a5..fd818da3 100644
--- a/core/modules/system/system.admin.inc
+++ b/core/modules/system/system.admin.inc
@@ -170,110 +170,63 @@ function template_preprocess_status_report(&$variables) {
}
/**
- * Returns HTML for the modules form.
+ * Prepares variables for the module details templates.
+ *
+ * Default template: system-modules-details.html.twig.
*
* @param $variables
* An associative array containing:
- * - form: A render element representing the form.
- *
- * @ingroup themeable
+ * - form: A render element representing the form. The main form element
+ * represents a package, and child elements of the form are individual
+ * projects. Each project (or module) is an associative array containing the
+ * following elements:
+ * - name: The name of the module.
+ * - enable: A checkbox for enabling the module.
+ * - description: (optional) A description of the module.
+ * - version: (optional) The version of the module.
+ * - links: (optional) Administration links provided by the module.
+ * - requires: (optional) A list of modules that the project requires.
+ * - required_by: (optional) A list of modules that require the project.
*/
-function theme_system_modules_details($variables) {
+function template_preprocess_system_modules_details(&$variables) {
$form = $variables['form'];
+ $variables['header'] = [
+ 'installed' => $form['#header'][0]['data'],
+ 'name' => $form['#header'][1]['data'],
+ 'description' => $form['#header'][2]['data'],
+ ];
- // Individual table headers.
- $rows = array();
+ $variables['modules'] = [];
// Iterate through all the modules, which are children of this element.
foreach (Element::children($form) as $key) {
// Stick the key into $module for easier access.
$module = $form[$key];
- // Create the row for the table.
- $row = array();
- // Add the checkbox into the first cell.
unset($module['enable']['#title']);
- $module['#requires'] = array_filter($module['#requires']);
- $module['#required_by'] = array_filter($module['#required_by']);
-
- $requires = !empty($module['#requires']);
- $required_by = !empty($module['#required_by']);
- $version = !empty($module['version']['#markup']);
-
- $row[] = array('class' => array('checkbox'), 'data' => drupal_render($module['enable']));
+ // Add the checkbox to allow installing new modules and to show the
+ // installation status of the module.
+ $module['checkbox'] = $module['enable'];
// Add the module label and expand/collapse functionality.
$id = Html::getUniqueId('module-' . $key);
- $col2 = [
- '#type' => 'inline_template',
- '#template' => '',
- '#context' => [
- 'id' => $id,
- 'enable_id' => $module['enable']['#id'],
- 'module_name' => $module['name'],
- ],
- ];
- $row[] = ['class' => ['module'], 'data' => $col2];
-
- // Add the description, along with any modules it requires.
- $description = '';
- $description .= '