summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2014-04-06 20:59:26 (GMT)
committerAlex Pott2014-04-06 20:59:26 (GMT)
commit5364b20d02039c7eb89fa7b0616a36ef7c171170 (patch)
tree3e19192112e211d8773c901c69996eff0bf5444d
parent4b6ba9f079352e26d992acc2353425736fc24560 (diff)
Issue #2100311 by killua99, yannickoo: Allow filtering of modules by arbitrary search strings on the uninstall page.
-rw-r--r--core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php24
-rw-r--r--core/modules/system/system.admin.inc5
2 files changed, 27 insertions, 2 deletions
diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php
index 219653f..7438e48 100644
--- a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php
+++ b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php
@@ -74,6 +74,29 @@ class ModulesUninstallForm extends FormBase {
return empty($modules[$module->getName()]->info['required']) && drupal_get_installed_schema_version($module->getName()) > SCHEMA_UNINSTALLED;
});
+ // Include system.admin.inc so we can use the sort callbacks.
+ $this->moduleHandler->loadInclude('system', 'inc', 'system.admin');
+
+ $form['filters'] = array(
+ '#type' => 'container',
+ '#attributes' => array(
+ 'class' => array('table-filter', 'js-show'),
+ ),
+ );
+
+ $form['filters']['text'] = array(
+ '#type' => 'search',
+ '#title' => $this->t('Search'),
+ '#size' => 30,
+ '#placeholder' => $this->t('Enter module name'),
+ '#attributes' => array(
+ 'class' => array('table-filter-text'),
+ 'data-table' => '#system-modules-uninstall',
+ 'autocomplete' => 'off',
+ 'title' => $this->t('Enter a part of the module name or description to filter by.'),
+ ),
+ );
+
$form['modules'] = array();
// Only build the rest of the form if there are any modules available to
@@ -112,6 +135,7 @@ class ModulesUninstallForm extends FormBase {
}
}
+ $form['#attached']['library'][] = 'system/drupal.system.modules';
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc
index 8cc1599..84e74c0 100644
--- a/core/modules/system/system.admin.inc
+++ b/core/modules/system/system.admin.inc
@@ -382,7 +382,7 @@ function theme_system_modules_uninstall($variables) {
}
$rows[] = array(
array('data' => drupal_render($form['uninstall'][$module]), 'align' => 'center'),
- '<strong><label for="' . $form['uninstall'][$module]['#id'] . '">' . drupal_render($form['modules'][$module]['name']) . '</label></strong>',
+ '<label for="' . $form['uninstall'][$module]['#id'] . '" class="module-name table-filter-text-source">' . drupal_render($form['modules'][$module]['name']) . '</label>',
array('data' => drupal_render($form['modules'][$module]['description']) . $disabled_message, 'class' => array('description')),
);
}
@@ -393,7 +393,8 @@ function theme_system_modules_uninstall($variables) {
'#rows' => $rows,
'#empty' => t('No modules are available to uninstall.'),
);
- $output = drupal_render($table);
+ $output = drupal_render($form['filters']);
+ $output .= drupal_render($table);
$output .= drupal_render_children($form);
return $output;