Remove disabled filters from text format configuration

Created on 1 December 2014, almost 10 years ago
Updated 3 March 2024, 9 months ago

Problem/Motivation

It is not necessary to storage information about disabled filters in the config system, because they describe state of system where the config is saved and pollute the config system.

It is also impossible to release a dependency on a module or plugin by disabling it from the filter.

Steps to reproduce

  1. Install Standard.
  2. Navigate to /admin/config/development/configuration/single/export and export the Full HTML text format
  3. Observe that filter_html is present (but has status: false) even though it is not enabled

Proposed resolution

Filter disabled filters before config save.

Remaining tasks

Tests?

User interface changes

API changes

📌 Task
Status

Needs work

Version

11.0 🔥

Component
Filter 

Last updated about 4 hours ago

No maintainer
Created by

🇩🇪Germany webflo

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇱Netherlands Eric_A

    This now needs a small cleanup after 🐛 Consistently sort filter formats to simplify config exports Fixed .
    As for the needed update function:filter_post_update_sort_filters() from that issue must be perfect example code.

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    This will help make 📌 [PP-2] Make FilterFormat config entities fully validatable Postponed simpler.

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    AFAICT this should also change

    # Filter with module and status.
    filter:
      type: mapping
      label: 'Filter'
      mapping:
        id:
          type: string
          label: 'ID'
          constraints:
            PluginExists:
              manager: plugin.manager.filter
              interface: 'Drupal\filter\Plugin\FilterInterface'
        provider:
          type: string
          label: 'Provider'
        status:
          type: boolean
          label: 'Status'
        weight:
          type: integer
          label: 'Weight'
        settings:
          type: filter_settings.[%parent.id]
    

    to:

    filter:
      type: mapping
      label: 'Filter'
      mapping:
        id:
          type: string
          label: 'ID'
          constraints:
            PluginExists:
              manager: plugin.manager.filter
              interface: 'Drupal\filter\Plugin\FilterInterface'
        provider:
          type: string
          label: 'Provider'
        weight:
          type: integer
          label: 'Weight'
        settings:
          type: filter_settings.[%parent.id]
    

    … because all entries in filter.format.*:filters will have status: true.

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    Also: \Drupal\ckeditor5\Plugin\CKEditor5PluginManager::isPluginDisabled() can be simplified thanks to this change:

    diff --git a/core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php b/core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php
    index 5f900126b1..5b1391a925 100644
    --- a/core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php
    +++ b/core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php
    @@ -483,10 +485,7 @@ protected function isPluginDisabled(CKEditor5PluginInterface $plugin, EditorInte
             case 'filter':
               $filters = $editor->getFilterFormat()->filters();
               assert($filters instanceof FilterPluginCollection);
    -          if (!$filters->has($required_value) || !$filters->get($required_value)->status) {
    -            return TRUE;
    -          }
    -          break;
    +          return !$filters->has($required_value);
     
             case 'requiresConfiguration':
               $intersection = array_intersect($plugin->getConfiguration(), $required_value);
    
  • Assigned to wim leers
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
  • Pipeline finished with Canceled
    6 months ago
    Total: 145s
    #187370
  • Pipeline finished with Failed
    6 months ago
    Total: 179s
    #187373
  • Pipeline finished with Failed
    6 months ago
    Total: 148s
    #187376
  • Pipeline finished with Success
    5 months ago
    Total: 622s
    #206569
Production build 0.71.5 2024