Support FieldFormatter PHP attributes in Drupal 10.3

Created on 8 March 2024, 8 months ago
Updated 6 April 2024, 7 months ago

Problem/Motivation

With the recent landing of 📌 Use PHP attributes instead of doctrine annotations Fixed in 10.2 and more recently with 📌 Convert FieldFormatter plugin discovery to attributes Active in 10.3 \o/, it appears that PHP Attributes introduced in 10.2 ( Change record: Plugin implementations should use PHP attributes instead of annotations ) should now be fully supported on 10.3 ( Change record: Plugins converted from Annotations to Attributes in 10.3.0 ).

Proposed resolution

Unfortunately, this change is going to require dropping versions earlier than 10.3, therefore, it should probably be done in a new minor version branch, for example: '2.2.x'.

  • Mostly the two modules' FieldFormatter plugin definitions need to be updated ('image_link_formatter' and 'responsive_image_link_formatter').
  • Modules' version requirements need to be updated to drop support for 10.2.
  • Remove conditions in Tests based on versions previously supported.

 

Code examples

Some examples of similar changes or tickets with code examples from Contrib or Core:

Useful documentation

 

Feel free to let us know if you have any questions, concerns or suggestions on this particular task, we would surely be glad to hear your feedback.
Thanks in advance !

📌 Task
Status

Fixed

Version

2.2

Component

Code

Created by

🇫🇷France dydave

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

Merge Requests

Comments & Activities

  • Issue created by @dydave
  • Pipeline finished with Success
    8 months ago
    Total: 223s
    #115320
  • Pipeline finished with Failed
    8 months ago
    Total: 132s
    #117790
  • Pipeline finished with Failed
    8 months ago
    Total: 42s
    #117794
  • Pipeline finished with Success
    8 months ago
    Total: 194s
    #117799
  • Pipeline finished with Success
    8 months ago
    Total: 599246s
    #117803
  • Pipeline finished with Success
    8 months ago
    Total: 186s
    #123746
  • Pipeline finished with Success
    8 months ago
    Total: 186s
    #123754
  • 🇫🇷France dydave

    The new branch 2.2.x was created with the corresponding release:
    image_link_formatter 2.2.x-dev

    The changes in ticket's issue fork also seem to be passing the tests, so switching version over to 2.2.x to prepare a merge request.

  • Pipeline finished with Success
    8 months ago
    Total: 198s
    #127227
    • DYdave committed 332b2015 on 2.2.x
      Issue #3426765 by DYdave: Added support for FieldFormatter PHP...
  • Status changed to Fixed 8 months ago
  • 🇫🇷France dydave

    The initial tests above at #4 were failing at the composer step because the module was being tested with Drupal 10.2.x, which is a dropped requirement in this new branch's composer.json.

    This could be a common use case, probably encountered by other module maintainers, when a new development branch drops compatibility for the currently supported version, to start working on supporting the next ones..

    Therefore, for the 2.2.x branch, the .gitlab-ci.yml file had to be updated to add a conditional case to skip to the next minor version:

    # Image Link Formatter: Pipeline configuration variables.
    workflow:
      rules:
        # Allow automated Tests Build Pipelines to run with the next minor version:
        # Drop support for '10.2.x'.
        - if: $CORE_SUPPORTED == "10.2.x-dev"
          variables:
            _TARGET_CORE: $CORE_NEXT_MINOR
    

    Once 10.3.x-dev becomes the $CORE_SUPPORTED version, then we should be able to remove this piece of code and probably start creating a recommended release.
     

    Otherwise everything else is mostly based on the links, resources and suggestions from the issue summary.

    All the changes have been merged at #5 in the new development release: image_link_formatter 2.2.x-dev .

    At this point, all the work to be carried in this ticket should have been completed, thus marking it as Fixed for now.

    Feel free to let us know if you have any questions, concerns or suggestions on any of the recent code changes or the new development branch, we would surely be glad to hear your feedback.
    Thanks in advance !

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

Production build 0.71.5 2024