Remove disabled filters from text format configuration

Created on 1 December 2014, over 9 years ago
Updated 3 March 2024, 4 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 2 days 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
    28 days ago
    Total: 145s
    #187370
  • Pipeline finished with Failed
    28 days ago
    Total: 179s
    #187373
  • Pipeline finished with Failed
    28 days ago
    Total: 148s
    #187376
  • Pipeline finished with Success
    4 days ago
    Total: 622s
    #206569
Production build 0.69.0 2024