Plugin implementations should use PHP attributes instead of annotations

Created on 8 November 2023, about 1 year ago
Updated 29 June 2024, 5 months ago

Problem/Motivation

Drupal released a change record at https://www.drupal.org/node/3395575 that outlines annotations are to be replaced with PHP attributes. I believe we have a few annotations in this module.

Proposed resolution

Swap out annotations with PHP attributes.

Remaining tasks

  1. Identify where annotations are used
  2. Determine what needs to be changed per the guidance in the change record
  3. Make the changes
📌 Task
Status

Fixed

Version

3.0

Component

Code

Created by

🇺🇸United States theMusician

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

Merge Requests

Comments & Activities

  • Issue created by @theMusician
  • 🇺🇸United States theMusician

    Right now the annotations are only supported for the following per the change record.

    Annotation class Attribute class Available since
    \Drupal\Core\Annotation\Action \Drupal\Core\Action\Attribute\Action 10.2.0
    \Drupal\Core\Block\Annotation\Block \Drupal\Core\Block\Attribute\Block 10.2.0

    Right now Able Player uses neither of these plugins. Will continue to monitor.

  • 🇮🇳India Vivek Panicker Kolkata

    Annotations are used by the following Field Formatters:
    - AbleplayerVideoFormatter
    - AbleplayerSignLanguageFormatter
    - AbleplayerRemoteVideoFormatter
    - AbleplayerPosterImageFormatter
    - AbleplayerChapterFormatter
    - AbleplayerCaptionFormatter
    - AbleplayerAudioFormatter

    We have Attribute available for Field formatter: https://www.drupal.org/node/3420980

    So we can start working on this.

  • 🇮🇳India Vivek Panicker Kolkata

    I have raised the MR, but that needs to be targeted against the Drupal 10.3.x branch.
    I am not sure how to do that.
    Also, we need to thoroughly test this.

  • Pipeline finished with Failed
    8 months ago
    Total: 139s
    #130656
  • Status changed to Needs review 7 months ago
  • 🇺🇸United States theMusician

    Thanks Vivek. Not sure we need to target against 10.3.x, this should all work against the 11.x branch. The tests themselves don't run currently, so seeing them fail on the pipeline is not surprising. The project has the goal of getting tests working, but any of the functional tests have stymied us.

  • Status changed to Needs work 7 months ago
  • 🇺🇸United States theMusician

    The attribute conversion looks good. We'll keep this branch open as more attributes become available. As we prepare to move to support 10.x and greater versions of Drupal and remove support for 9.x, we can spin a new release that has the attributes in it and leave a 3.x version available for all on Drupal 9.x.

    Thank you for your contributions to this work.

  • 🇮🇳India Vivek Panicker Kolkata

    @theMusician

    > Not sure we need to target against 10.3.x, this should all work against the 11.x branch.
    Got it, thanks.

    > We'll keep this branch open as more attributes become available.
    But we don't have any other code using annotations.
    Is there any other code for which we are waiting for the attributes to become available?

    > Thank you for your contributions to this work.
    Happy to help! :)

  • Status changed to Needs review 7 months ago
  • 🇺🇸United States theMusician

    You are right, we don't have any other annotations. I thought there was a section of code but it turns out I was wrong.

    As we get a 3.1.x release set we'll work this in.

    Setting to needs review.

  • Status changed to Fixed 5 months ago
  • 🇺🇸United States CarlyGerard

    Thanks Vivek, this change is merged in the dev branch.

  • 🇮🇳India Vivek Panicker Kolkata

    Happy to help! :)

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

Production build 0.71.5 2024