Commit 5364b20d authored by alexpott's avatar alexpott

Issue #2100311 by killua99, yannickoo: Allow filtering of modules by arbitrary...

Issue #2100311 by killua99, yannickoo: Allow filtering of modules by arbitrary search strings on the uninstall page.
parent 4b6ba9f0
......@@ -74,6 +74,29 @@ public function buildForm(array $form, array &$form_state) {
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 @@ public function buildForm(array $form, array &$form_state) {
}
}
$form['#attached']['library'][] = 'system/drupal.system.modules';
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment