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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lwalley created an issue. See original summary.

lwalley’s picture

Attached 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.

Devin Carlson’s picture

Status: Active » Needs review
Devin Carlson’s picture

Status: Needs review » Fixed

Thanks for the patch! Tested and committed.

  • Devin Carlson committed 37460a0 on 7.x-3.x authored by lwalley
    Issue #2580557 by lwalley: Fixed media browser does not restrict library...

  • Devin Carlson committed d9f8b0f on 7.x-2.x authored by lwalley
    Issue #2580557 by lwalley: Fixed media browser does not restrict library...

  • Devin Carlson committed fad5b73 on 7.x-1.x authored by lwalley
    Issue #2580557 by lwalley: Fixed media browser does not restrict library...

Status: Fixed » Closed (fixed)

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