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.
When using media browser to select a file entity for embedding, the media browser library does not appear to filter the list of available files by the bundles allowed in the entity embed button configuration. Using Entity Embed 7.x-1.x and 7.x-2.x, Media 7.x-2.0-beta1, File Entity 7.x-2.0-beta2 and CKEditor 7.x-1.16+9-dev.
Quick notes to reproduce:
- Create an Entity Embed button for file entity and limit to image bundle.
- Add button to CKEditor and add CKEditor to body field etc.
- Add files of type image and document through the Media add file interface (/admin/content/file).
- Create a new node and when using the entity embed button on the CKEditor WYSIWYG with Media integration, selecting a file brings up the Media browser and views results shows all bundles, i.e. both document and image file not just the image file.
It seems the media field expects '#media_options' attribute in order to pass parameters to the media browser. Entity Embed creates a media field but does not appear to set any media options.
Patch to follow.
Comment | File | Size | Author |
---|---|---|---|
#2 | entity_embed-add-options-to-media-field-2580557-2.patch | 671 bytes | lwalley |
Comments
Comment #2
lwalley CreditAttribution: lwalley commentedAttached is patch against 7.x-2.x branch to add '#media_options' to media field in entity embed dialog form, and pass button's bundle settings to media browser.
Comment #3
Devin Carlson CreditAttribution: Devin Carlson commentedComment #4
Devin Carlson CreditAttribution: Devin Carlson commentedThanks for the patch! Tested and committed.