Convert MediaSource plugin discovery to attributes

Created on 13 February 2024, about 1 year ago
Updated 20 April 2024, 10 months ago

Problem/Motivation

In πŸ“Œ Use PHP attributes instead of doctrine annotations Fixed we added support for attribute based plugin discovery.
As part of that issue we converted block and action plugins.

This issue is to convert \Drupal\media\Annotation\MediaSourceplugins to use Attributes.

Proposed resolution

  1. Add a class to represent the new Attribute - Example
  2. Update the plugin manager constructor to include both the attribute and annotation class names - example
  3. Convert all plugins that use the annotation to use the new attribute - example

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Fixed

Version

10.3 ✨

Component
MediaΒ  β†’

Last updated 2 days ago

Created by

πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

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

Merge Requests

Comments & Activities

  • Issue created by @larowlan
  • First commit to issue fork.
  • Pipeline finished with Success
    about 1 year ago
    Total: 648s
    #98255
  • Status changed to Needs work 12 months ago
  • πŸ‡¦πŸ‡ΊAustralia mstrelan
  • First commit to issue fork.
  • Pipeline finished with Canceled
    12 months ago
    Total: 173s
    #107786
  • Pipeline finished with Canceled
    12 months ago
    Total: 37s
    #107791
  • Status changed to Needs review 12 months ago
  • Pipeline finished with Failed
    12 months ago
    Total: 173s
    #107794
  • Status changed to Needs work 12 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Seems to have a check failure

  • Pipeline finished with Canceled
    12 months ago
    #108737
  • Status changed to Needs review 12 months ago
  • πŸ‡·πŸ‡ΊRussia sorlov

    Fixed phpstan issue

  • Pipeline finished with Success
    12 months ago
    Total: 568s
    #108739
  • Status changed to Needs work 12 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Left some comments on the MR.

  • Pipeline finished with Canceled
    12 months ago
    Total: 290s
    #116127
  • Pipeline finished with Failed
    12 months ago
    Total: 172s
    #116130
  • Pipeline finished with Success
    12 months ago
    Total: 480s
    #116131
  • Status changed to Needs review 12 months ago
  • Status changed to Needs work 12 months ago
  • πŸ‡¦πŸ‡ΊAustralia mstrelan

    Still need to fix the forms key

  • Pipeline finished with Success
    12 months ago
    Total: 511s
    #116172
  • Pipeline finished with Success
    12 months ago
    Total: 608s
    #116199
  • Status changed to Needs review 12 months ago
  • Status changed to RTBC 12 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Appears feedback has been addressed

  • Status changed to Needs work 12 months ago
  • πŸ‡¦πŸ‡ΊAustralia mstrelan

    Think there is a syntax error in the example.

  • Status changed to Needs review 12 months ago
  • Pipeline finished with Success
    12 months ago
    Total: 541s
    #117101
  • Status changed to RTBC 12 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Good catch! Appears typo has been resolved

  • Status changed to Needs work 12 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    I've left some review comments on the MR - it looks as though we have some incorrect information in the docs and maybe some unused parameters - can someone open the requested follow-ups and also make the suggested improvements to the MR. Thanks!

  • Pipeline finished with Canceled
    11 months ago
    Total: 119s
    #123017
  • Pipeline finished with Canceled
    11 months ago
    Total: 59s
    #123018
  • Pipeline finished with Success
    11 months ago
    Total: 591s
    #123021
  • πŸ‡·πŸ‡ΊRussia sorlov

    Made suggested improvements

  • First commit to issue fork.
  • Status changed to Needs review 11 months ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    I reviewed the unresolved threads and found that they have been resolved. The last three were for followups, which I have just created. All tests are passing, so I am setting to NR.

  • Status changed to Postponed: needs info 11 months ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    This is on hold. The work is being done in πŸ“Œ Update MigratePluginManager to include both attribute and annotation class Fixed

  • Status changed to Needs review 11 months ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    Sorry for the noise, this is the wrong issue.

  • Status changed to RTBC 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Feedback/follow ups seem to be addressed

    Searched again for @MediaSource all instances appear to be replaced.

    Believe this one is good to go.

  • Status changed to Needs work 11 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    I think we need to discuss the providers key. I don't think it should be on the MediaSource attribute it is only meaningful for the oembed plugin and it is set in the dervier anyway - so I think that means we don't need it in the attribute. It would be good to look at how any module providing an ombed integration is doing it.

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    If they follow the example in \Drupal\media\Plugin\media\Source\OEmbed then it will work because that is telling them to do a example_media_source_info_alter

  • Pipeline finished with Success
    11 months ago
    Total: 493s
    #132398
  • Status changed to Needs review 11 months ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    I made the suggested changes but this still needs discussion of that idea.

  • Status changed to RTBC 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Appears feedback has been addressed.

    Sure we would of seen it in tests but made sure that remote embeds still work when using the MR.

  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    Seems very strange to me to have a plugin definition key that only a specific implementation (and its derivates) use. Feels like an incorrect use of plugin definitions to me, but I don't have any great ideas on how to change that, certainly not in the scope of this issue. So +1 I guess :)

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Think it’s worth it to explore alternatives in a follow up?

  • Status changed to Needs work 11 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    So looking at contrib we need to think about this some more... for example we have https://git.drupalcode.org/project/media_entity_podbean/-/blob/1.0.x/src...
    ... sorry should have caught this earlier.

    I think we need to create an new OEmbedMediaSource attribute that extends our new attribute. I think this will work just fine because we do an instanceof check in \Drupal\Component\Plugin\Discovery\AttributeClassDiscovery::parseClass and an is_a in \Drupal\Component\Annotation\Doctrine\StaticReflectionParser::hasClassAttribute()

  • Pipeline finished with Canceled
    11 months ago
    Total: 2s
    #137046
  • Pipeline finished with Success
    11 months ago
    Total: 630s
    #137047
  • Status changed to Needs review 11 months ago
  • Status changed to RTBC 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Appears feedback for a separate oemebd attribute has been added.

    • alexpott β†’ committed 7f69b30b on 10.3.x
      Issue #3420997 by sorlov, quietone, DanielVeza, smustgrave, alexpott,...
    • alexpott β†’ committed 7201d4bf on 11.x
      Issue #3420997 by sorlov, quietone, DanielVeza, smustgrave, alexpott,...
  • Status changed to Fixed 11 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Committed 7201d4b and pushed to 11.x. Thanks!
    Committed 7f69b30 and pushed to 10.3.x. Thanks!

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

Production build 0.71.5 2024