Problem/Motivation

If you use the Lightning media browser on a media reference field, it always shows all media types by default, even if the media field has been configured to only allow specific bundles.

Proposed resolution

Use an in-review Entity Browser patch from #2865928: Provide method for views widget to filter based on context to contextually filter the browser based on a supplied widget context.

Remaining tasks

Review patch, write tests. Test coverage should be simple - just add a media reference field to any entity type and restrict the allowed bundles to "Image" and "Document". Next, create an Image, Document, and Tweet Media entity. Then, go to use the media browser on the aforementioned entity type, and you should see the Image and Document you created, but not the Tweet.

User interface changes

Users who are already using the media browser with a media reference field will now see it filter based on their field settings.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

samuel.mortenson created an issue. See original summary.

balsama’s picture

balsama’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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