Create enum for FilterInterface:TYPE_* constants

Created on 29 February 2024, 11 months ago
Updated 10 March 2024, 11 months ago

Problem/Motivation

\Drupal\filter\Plugin\FilterInterface declares constants for each of the following filter types: TYPE_MARKUP_LANGUAGE, TYPE_HTML_RESTRICTOR, TYPE_TRANSFORM_REVERSIBLE, TYPE_TRANSFORM_IRREVERSIBLE. They happen to be integers because constants need a value, but since they are never serialized or written to a database we don't need them to be backed, except probably for BC.

Steps to reproduce

Proposed resolution

  • Create a new enum FilterType with cases for MarkupLanguage, HtmlRestrictor, TransformReversible and TransformIrreversible.
  • Update references to these constants to get the enum instead
  • Add BC layer to find these by their former integer value
  • Remove integer backing in a later version

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Needs work

Version

11.0 🔥

Component
Filter  →

Last updated 7 days ago

No maintainer
Created by

🇦🇺Australia mstrelan

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

Merge Requests

Comments & Activities

  • Issue created by @mstrelan
  • 🇦🇺Australia mstrelan
  • Status changed to Needs work 11 months ago
  • 🇦🇺Australia mstrelan

    First pass, see what the test bot thinks. Still a few references to the legacy consts and some deprecation to do.

  • Pipeline finished with Failed
    11 months ago
    Total: 187s
    #107443
  • Pipeline finished with Failed
    11 months ago
    Total: 186s
    #107447
  • Pipeline finished with Failed
    11 months ago
    Total: 164s
    #107450
  • Pipeline finished with Failed
    11 months ago
    Total: 444s
    #107457
  • Pipeline finished with Failed
    11 months ago
    Total: 638s
    #107467
  • Pipeline finished with Running
    11 months ago
    #107482
  • Pipeline finished with Success
    11 months ago
    Total: 477s
    #107496
  • 🇦🇺Australia mstrelan

    Have put in some @todos where I think we can trigger deprecations. We should also have a test module using the old constants in the plugin annotations.

    Also adding 📌 Convert Filter plugin discovery to attributes Needs work as related.

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    Yes, please!

    This looks fantastic!

    I posted an idea for how to deal with the getFilterType() return type conundrum. Not 100% sure yet if it'll work, but it's a start :D

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    📌 Convert Filter plugin discovery to attributes Needs work landed, let's push this forward again?

  • 🇦🇺Australia mstrelan

    Rebased on 11.x and updated the attribute to expect the enum instead of int. Hopefully we don't have to deprecate passing an int to in the attribute if we can get this out before a 10.3 release? Needs work to address the feedback from Wim.

  • Pipeline finished with Canceled
    11 months ago
    Total: 518s
    #116021
  • Pipeline finished with Success
    11 months ago
    Total: 480s
    #116027
Production build 0.71.5 2024