diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php
index ee3f145..9e4231c 100644
--- a/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php
+++ b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php
@@ -142,19 +142,22 @@ public function buildForm(array $form, array &$form_state) {
// Add a wrapper around every package.
foreach (element_children($form['modules']) as $package) {
- $form['modules'][$package] += array(
- '#type' => 'details',
- '#title' => $this->t($package),
- '#open' => TRUE,
- '#theme' => 'system_modules_details',
+ $table = array(
+ '#type' => 'table',
'#header' => array(
array('data' => '' . $this->t('Installed') . '', 'class' => array('checkbox')),
array('data' => $this->t('Name'), 'class' => array('name')),
array('data' => $this->t('Description'), 'class' => array('description', RESPONSIVE_PRIORITY_LOW)),
),
- '#attributes' => array('class' => array('package-listing')),
+ ) + $form['modules'][$package];
+ $form['modules'][$package] = array(
+ '#type' => 'details',
+ '#title' => $this->t($package),
+ '#open' => TRUE,
// Ensure that the "Core" package comes first.
'#weight' => $package == 'Core' ? -10 : NULL,
+ '#attributes' => array('class' => array('package-listing')),
+ 'table' => $table,
);
}
@@ -185,35 +188,37 @@ public function buildForm(array $form, array &$form_state) {
*/
protected function buildRow(array $modules, $module, $distribution) {
// Set the basic properties.
- $row['#required'] = array();
- $row['#requires'] = array();
- $row['#required_by'] = array();
-
- $row['name']['#markup'] = $module->info['name'];
- $row['description']['#markup'] = $this->t($module->info['description']);
- $row['version']['#markup'] = $module->info['version'];
+ $row['#version'] = $module->info['version'];
+ $row['#requires'] = isset($row['#requires']) ? $row['#requires'] : FALSE;
+ $row['#required_by'] = isset($row['#required_by']) ? $row['#required_by'] : FALSE;
// Add links for each module.
// Used when checking if a module implements a help page.
$help = $this->moduleHandler->moduleExists('help') ? drupal_help_arg() : FALSE;
// Generate link for module's help page, if there is one.
- $row['links']['help'] = array();
+ $row_links['help'] = array();
if ($help && $module->status && in_array($module->name, $this->moduleHandler->getImplementations('help'))) {
if ($this->moduleHandler->invoke($module->name, 'help', array("admin/help#$module->name", $help))) {
- $row['links']['help'] = array(
+ $row_links['help'] = array(
'#type' => 'link',
'#title' => $this->t('Help'),
'#href' => "admin/help/$module->name",
- '#options' => array('attributes' => array('class' => array('module-link', 'module-link-help'), 'title' => $this->t('Help'))),
+ '#options' => array(
+ 'attributes' => array(
+ 'id' => 'edit-modules-core-' . $module->name . '-links-help',
+ 'class' => array('module-link', 'module-link-help'),
+ 'title' => $this->t('Help'),
+ ),
+ ),
);
}
}
// Generate link for module's permission, if the user has access to it.
- $row['links']['permissions'] = array();
+ $row_links['permissions'] = array();
if ($module->status && user_access('administer permissions') && in_array($module->name, $this->moduleHandler->getImplementations('permission'))) {
- $row['links']['permissions'] = array(
+ $row_links['permissions'] = array(
'#type' => 'link',
'#title' => $this->t('Permissions'),
'#href' => 'admin/people/permissions',
@@ -222,7 +227,7 @@ protected function buildRow(array $modules, $module, $distribution) {
}
// Generate link for module's configuration page, if it has one.
- $row['links']['configure'] = array();
+ $row_links['configure'] = array();
if ($module->status && isset($module->info['configure'])) {
if ($this->accessManager->checkNamedRoute($module->info['configure'], array(), \Drupal::currentUser())) {
$result = $this->queryFactory->get('menu_link')
@@ -230,7 +235,7 @@ protected function buildRow(array $modules, $module, $distribution) {
->execute();
$menu_items = $this->entityManager->getStorageController('menu_link')->loadMultiple($result);
$item = reset($menu_items);
- $row['links']['configure'] = array(
+ $row_links['configure'] = array(
'#type' => 'link',
'#title' => $this->t('Configure'),
'#route_name' => $module->info['configure'],
@@ -247,7 +252,7 @@ protected function buildRow(array $modules, $module, $distribution) {
// Present a checkbox for installing and indicating the status of a module.
$row['enable'] = array(
'#type' => 'checkbox',
- '#title' => $this->t('Install'),
+ '#wrapper_attributes' => array('class' => array('checkbox')),
'#default_value' => (bool) $module->status,
'#disabled' => (bool) $module->status,
);
@@ -339,6 +344,64 @@ protected function buildRow(array $modules, $module, $distribution) {
}
}
+ // Set id for checkbox here so module label can reference it.
+ $id = drupal_html_class('edit-modules-' . $module->info['package'] . '-' . $module->name . '-enable');
+
+ $row['name']['#markup'] = $module->info['name'];
+
+ $row['enable'] += array(
+ '#id' => $id,
+ '#parents' => array('modules', $module->info['package'], $module->name, 'enable'),
+ );
+
+ // Add the module label and expand/collapse functionalty.
+ $row['name'] = array(
+ '#prefix' => '',
+ '#wrapper_attributes' => array(
+ 'class' => array('module'),
+ ),
+ );
+
+ // Add the description, along with any modules it requires.
+ $description = '';
+ if ($module->info['version'] || $row['#requires'] || $row['#required_by']) {
+ $description .= '
';
+ if ($module->info['version']) {
+ $description .= '
' . $this->t('Version: !module-version', array('!module-version' => $module->info['version'])) . '
';
+ }
+ if ($row['#requires']) {
+ $description .= '
' . $this->t('Requires: !module-list', array('!module-list' => implode(', ', $row['#requires']))) . '
';
+ }
+ if ($row['#required_by']) {
+ $description .= '
' . $this->t('Required by: !module-list', array('!module-list' => implode(', ', $row['#required_by']))) . '
';
+ }
+ $description .= '
';
+ }
+
+ $links = '';
+ foreach (array('help', 'permissions', 'configure') as $key) {
+ $links .= (isset($row_links[$key]) ? drupal_render($row_links[$key]) : '');
+ }
+
+ if ($links) {
+ $description .= ' ';
+ $description .= $links;
+ $description .= '
';
+ }
+
+ $row['description'] = array(
+ '#type' => 'details',
+ '#title' => ' ' . $this->t($module->info['description']) . '',
+ '#attributes' => array('id' => $id . '-description'),
+ '#description' => $description,
+ '#collapsed' => TRUE,
+ '#wrapper_attributes' => array(
+ 'class' => array('description', 'expand'),
+ ),
+ );
+
return $row;
}
@@ -371,6 +434,7 @@ protected function buildModuleList(array $form_state) {
// First, build a list of all modules that were selected.
foreach ($packages as $items) {
+ unset($items['table']);
foreach ($items as $name => $checkbox) {
if ($checkbox['enable'] && !$this->moduleHandler->moduleExists($name)) {
$modules['install'][$name] = $data[$name]->info['name'];
diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php
index 93bf906..1383935 100644
--- a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php
+++ b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php
@@ -74,7 +74,22 @@ public function buildForm(array $form, array &$form_state) {
return empty($modules[$module->name]->info['required']) && drupal_get_installed_schema_version($module->name) > SCHEMA_UNINSTALLED;
});
- $form['modules'] = array();
+ $profile = drupal_get_profile();
+
+ // Sort all modules by their name.
+ if(!empty($uninstallable)) {
+ uasort($uninstallable, 'system_sort_modules_by_info_name');
+ }
+
+ $form['uninstall'] = array(
+ '#type' => 'table',
+ '#header' => array(
+ 'title' => array('data' => $this->t('Name')),
+ 'description' => array('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;
@@ -82,36 +97,45 @@ public function buildForm(array $form, array &$form_state) {
return $form;
}
- $profile = drupal_get_profile();
+ $form['unistall'] = array();
+ foreach ($uninstallable as $module) {
- // Sort all modules by their name.
- uasort($uninstallable, 'system_sort_modules_by_info_name');
+ // Define