Restrict media types by permission for entity reference field widget

Created on 10 March 2023, over 1 year ago

The project I'm working on has a use case where they need both the media library via WYSIWYG to restrict media types available by permission and also media library via entity reference to restrict media types available by permission (they have a catch-all entity reference field that supports referencing all of the site's media types, but they only want certain roles to be able to add existing audio/video media into that field).

I took a first pass at decorating the MediaLibraryWidget field widget plugin to reset the list of allowed media types depending on if the user has the appropriate permission. Once I've more time to circle back, I can add tests but figured I'd put this patch out there in case anyone else has a similar use case.

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States cainaru Norwood, NY, USA

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024