diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc
index 11b72a5..1223930 100644
--- a/core/modules/system/system.admin.inc
+++ b/core/modules/system/system.admin.inc
@@ -170,39 +170,49 @@ 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.
+ * - description: (optional) A description of the module.
+ * - version: (optional) The version of the module.
+ * - links: (optional) Administration links provided by the module.
+ * - enable: A checkbox for enabling 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'];
- // Individual table headers.
- $rows = array();
+ $header = array(
+ 'installed' => $form['#header'][0]['data'],
+ 'name' => $form['#header'][1]['data'],
+ 'description' => $form['#header'][1]['data'],
+ );
+
+ $modules = array();
// 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']);
+ // Create a new array for this module.
+ $item = array();
- $row[] = array('class' => array('checkbox'), 'data' => drupal_render($module['enable']));
+ // Add the checkbox.
+ unset($module['enable']['#title']);
+ $item['checkbox'] = $module['enable'];
// Add the module label and expand/collapse functionality.
$id = Html::getUniqueId('module-' . $key);
- $col2 = [
+ $label = [
'#type' => 'inline_template',
'#template' => '',
'#context' => [
@@ -211,21 +221,29 @@ function theme_system_modules_details($variables) {
'module_name' => $module['name'],
],
];
- $row[] = ['class' => ['module'], 'data' => $col2];
+ $item['name'] = $label;
- // Add the description, along with any modules it requires.
$description = '';
- $description .= '
';
+ // Begin building out the description content for the module details.
$renderer = \Drupal::service('renderer');
$machine_name_render = [
'#prefix' => '',
'#plain_text' => $key,
- '#suffix' => ' '',
];
- $description .= '