Skip to content
Snippets Groups Projects
Commit 154b593e authored by Stephen Mustgrave's avatar Stephen Mustgrave
Browse files

Issue #3024306: Enable/Disable Permissions Filter (Avoids conflicts) [Patch Inside]

parent f8858157
No related branches found
No related tags found
1 merge request!29Issue #3024306: Enable/Disable Permissions Filter (Avoids conflicts) [Patch Inside]
tabs: true
path: false
enabled_filters:
permissions: true
......@@ -6,5 +6,12 @@ module_filter.settings:
type: boolean
label: 'Boolean indicating whether the Extend page should be enhanced with tabs'
path:
type: integer
type: boolean
label: 'Show module path in modules list'
enabled_filters:
type: mapping
label: 'Enabled filters'
mapping:
permissions:
type: boolean
label: 'Enable filter on the permissions page'
......@@ -20,3 +20,23 @@ function module_filter_uninstall() {
$state = \Drupal::state();
$state->delete('module_filter.recent');
}
/**
* Add the filters_enabled.permission default configuration.
*/
function module_filter_update_9401() {
$config_factory = \Drupal::configFactory();
$config = $config_factory->getEditable('module_filter.settings');
$config->set('enabled_filters.permissions', TRUE);
$config->save(TRUE);
}
/**
* Ensure that the 'path' configuration property is a boolean.
*/
function module_filter_update_9402() {
$config_factory = \Drupal::configFactory();
$config = $config_factory->getEditable('module_filter.settings');
$config->set('path', (bool) $config->get('path'));
$config->save(TRUE);
}
......@@ -157,6 +157,11 @@ function module_filter_form_system_modules_uninstall_alter(&$form, FormStateInte
* Implements hook_form_FORM_ID_alter().
*/
function module_filter_form_user_admin_permissions_alter(&$form, FormStateInterface $form_state, $form_id) {
$config = \Drupal::config('module_filter.settings');
if (!$config->get('enabled_filters.permissions')) {
return;
}
$request_object = \Drupal::request();
$form['filters'] = [
'#type' => 'container',
......
......@@ -44,6 +44,20 @@ class ModuleFilterSettingsForm extends ConfigFormBase {
'#default_value' => $config->get('path'),
];
$form['filters'] = [
'#type' => 'fieldset',
'#title' => $this->t('Filters'),
'#description' => $this->t('Enable filters for use around the administration pages.'),
'#collapsible' => FALSE,
];
$form['filters']['permissions'] = [
'#type' => 'checkbox',
'#title' => $this->t('Permissions'),
'#description' => $this->t('Enable the filter on the permissions page.'),
'#default_value' => $config->get('enabled_filters.permissions'),
];
return $form;
}
......@@ -54,6 +68,7 @@ class ModuleFilterSettingsForm extends ConfigFormBase {
$values = $form_state->getValues();
$this->config('module_filter.settings')
->set('tabs', $values['tabs'])
->set('enabled_filters.permissions', $values['permissions'])
->set('path', $values['path'])
->save();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment