Convert from annotations to attributes

Created on 26 March 2025, about 2 months ago

Problem/Motivation

Drupal core currently supports plugin definitions using either annotations or attributes. At some point, annotations will be deprecated, and then support will be removed. We should use attributes for better long-term support.

Proposed resolution

  1. Replace src/Annotation/Modeler.php with src/Attribute/Modeler.php.
  2. Update the classes in src/Plugin/modeler_api/ to use attributes.
  3. Open a related issue for the bpmn_io module to convert its plugin to use attributes.

Remaining tasks

User interface changes

None

API changes

Modeler plugins will use a new attribute class instead of annotations.

Data model changes

None

πŸ“Œ Task
Status

Active

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States benjifisher Boston area

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

Merge Requests

Comments & Activities

  • Issue created by @benjifisher
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Agreed, we should always use the latest standards. We're already working on that for all sorts of annotations that are in ECA, so it should be done here and in bpmn_io as well.

  • First commit to issue fork.
  • πŸ‡ΊπŸ‡ΈUnited States cosmicdreams Minneapolis/St. Paul

    The issue I encountered in πŸ› Refactor breaks eca_ui Active was actually caused while working on this issue. It's obvious why now that I think about it a bit. I was able to create the Attributes, but need to use the "backwards compatibility" strategy outlined here: https://www.drupal.org/node/3395582 β†’

    I'm going to create follow up issues for the ECA and BPMN.io modules to convert their plugins to use the Attribute syntax. I wonder if it would be helpful to keep the backwards compatibility implementation around until folks get used to writing Attributes instead of Annotations.

    I also noticed that the way we are actually using the properties of the Annotation/Attribute is to put TranslateableMarkup in there (instead of just a string). Is it best to keep the property's data type to be a string instead of a TranslateableMarkup?

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    We already have issues about attributes and there are people already working on it. I don't think we need to do a lot now for ECA or bpmn_io, they are both in good shape.

  • Merge request !53515584: A number of needed fixes β†’ (Merged) created by cosmicdreams
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Here is the ECA issue that already exists for this topic: πŸ“Œ Convert plugin annotations to attributes Active

    And bpmn_io only has 1 plugin which will have to be converted when the modeler plugin interface will have been converted.

  • πŸ‡ΊπŸ‡ΈUnited States cosmicdreams Minneapolis/St. Paul

    That's great that folks are working on converting Annotations to Attributes in general.

    I was specifically talking about the new plugin types that we are introducing in modeler_api. Without the backwards compatibility built into the Modeler and ModelOwner plugin managers, we will have the bugs I mentioned. I have quick fixes ready for:

    • Drupal\eca_ui\Plugin\modeler_api_model_owner\Eca
    • Drupal\bpmn_io\Plugin\modeler_api_modeler\BpmnIo

    Both are the only ones (so far) to implement modeler_apis plugins. I'll go ahead and create issues and fixes for these and get this all wrapped up.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    That makes sense !

  • Pipeline finished with Skipped
    8 days ago
    #489253
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Fixed this together with the 2 implementations at ECA and bpmn_io.

Production build 0.71.5 2024