Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Media entities currently use the default entity reference selection plugin (\Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection)
This doesn't take into account the 'published' flag.
Proposed resolution
Add a new selection plugin for media.
Remaining tasks
Reviews
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#8 | 2995405-8.patch | 6.89 KB | amateescu |
#8 | 2995405-8-test-only.patch | 4.84 KB | amateescu |
fix_media_access_bypass.patch | 5.63 KB | larowlan | |
fix_media_access_bypass-test-only.patch | 3.59 KB | larowlan | |
Comments
Comment #3
larowlanComment #4
larowlanComment #6
chr.fritschI am wondering if this could be built as a PublishableEntitySelection handler, because it looks to me that there is nothing really specific media code in there. Probably Terms would like to inherit from that then as well.
Comment #7
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedThat's exactly what I started to write when I found the problem in Media and reported it privately :) However, in the meantime I realized that we can't have a generic
PublishableEntitySelection
implementation at least until #2809177: Introduce entity permission providers, which should provide a unified way of getting the permissions needed for the entity query condition.Comment #8
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedRerolled and updated the patch to current HEAD. Also, isn't this at least major?
Comment #10
chr.fritschThis is looking good.
Comment #11
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedIf that's the case does
Block
need a custom selection handler as well? In both these cases, thepublished
entity key andadmin_permission
annotation key would satisfy both use cases. It might be a good enough default implementation?Comment #12
amateescu CreditAttribution: amateescu for Pfizer, Inc. commented@Sam152, a custom selection handler for custom blocks is being added in #2987159: Create an entity reference selection plugin for custom blocks that filters out non-reusable blocks, and I don't think we should try to generalize things based on the
admin_permission
annotation key because that is too restrictive IMO.Comment #13
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedGotcha, that makes sense. +1 RTBC.
Comment #16
larowlanfixed on commit
Committed da2a2d2 and pushed to 8.7.x.
Cherry-picked as 8b23c65 and pushed to 8.6.x.