Convert annotations to attributes

Created on 27 June 2025, about 2 months ago

Problem/Motivation

Attributes are faster than annotation. Annotation is deprecated.

Steps to reproduce

Proposed resolution

Convert annotations to attributes

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇺🇸United States bluegeek9

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

Merge Requests

Comments & Activities

  • Issue created by @bluegeek9
  • 🇮🇪Ireland lostcarpark

    Before proceeding we need to decide our target minimum version:

    • Drupal 10.2: Supports attributes for Blocks and Actions (see CR 3395575 ). I don't think either are currently used in CRM.
    • Drupal 10.3: Adds attributes for a long list of objects, including Constraint, ViewsField, ViewsQuery used by CRM. See CR 3229001 for the full list.
    • Drupal 11.1: Adds attributes for ContentEntity and ConfigEntity. These are the bulk of annotations in CRM. See CR 3505422 .

    So if we need to support D10, we can only convert plugin attributes for now. We may wish to maintain support for D10 until its end of life in summer 2026. We would need to increase the minimum supported version to 10.3, but earlier versions are out of support anyway.

    If we would like to convert entity annotations, it means raising our minimum supported version to 11.1. This may be acceptable if we consider it's a new module, and the majority of sites using CRM may be Drupal CMS sites, which will be D11 based from the outset.

  • Pipeline finished with Success
    about 1 month ago
    Total: 252s
    #538333
  • 🇮🇪Ireland lostcarpark

    To start this off, I have converted the annotations to attributes for plugins.

    I'm leaving entities until we decide what our minimum supported Drupal version is.

  • 🇮🇪Ireland lostcarpark

    At Member Platform Zoom meeting, 3 Jul, the issue was discussed, and most agreed that it is better to comply with latest standards than support all possible versions of Drupal.

    It was also mentioned that CRM module is targeting a stable release for DrupalCon Chicago, which should be only a few months from D10 end of life.

    On this basis, I'm going to continue working on converting entity annotations to attributes, and bump the minimum supported version to 11.1.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 548s
    #539256
  • 🇮🇪Ireland lostcarpark

    I have converted ContactDetailType to use attributes. I picked it for the first one because I thought a config entity might be slightly easier than a content one.

    Tests are passing for current and future versions.

    As expected, tests fail for previous minor and previous major. I believe GitlabCI is still running on 11.1. It should soon be moving to 11.2, so we should be able to test against previous minor again soon. We will need to turn off previous major until D12.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 500s
    #539515
  • Pipeline finished with Failed
    about 1 month ago
    Total: 478s
    #539533
  • Pipeline finished with Success
    about 1 month ago
    Total: 280s
    #539536
  • Pipeline finished with Success
    about 1 month ago
    Total: 248s
    #539645
  • Pipeline finished with Success
    about 1 month ago
    Total: 307s
    #540517
  • 🇮🇪Ireland lostcarpark

    I converted UserContact to attributes.

    I encountered this issue.

     *     "local_task_provider" = {
     *       "default" = "\Drupal\entity\Menu\DefaultEntityLocalTaskProvider",
     *     },
    

    I couldn't find this in core, and eventually tracked it down to the Entity API module, which isn't a dependency of CRM.

    After discussing with @bluegeek9, removed above section from the attributes.

    Tests all pass, but will need additional testing to make sure it isn't needed.

  • Pipeline finished with Skipped
    about 1 month ago
    #543517
  • 🇺🇸United States bluegeek9

    There are a few entities that need to be converted to Attributes.

  • 🇺🇸United States bluegeek9

    bluegeek9 changed the visibility of the branch 1.0.x to hidden.

  • Pipeline finished with Skipped
    about 1 month ago
    #545952
    • bluegeek9 committed c40f05c5 on 1.0.x
      Issue #3532865 by bluegeek9, lostcarpark: Convert annotations to...
  • 🇮🇪Ireland lostcarpark

    Thanks for finishing this off. Sorry I didn't get it all done - it's been one of those weeks!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024