Problem/Motivation

After upgrading to 8.7.x the Media Entity Embed of Media Library no longer lists images. Reverting to 8.6.x continues to work. Raising here as an image field using the exact same Entity Browser does work correctly.

Before:
Before upgrading to 8.7 or when reverting code back after updating

After:
After upgrading to 8.7

As nobody else has raised this issue yet, attaching my configuration of the Entity Browser and Entity Embed in case it is an edge case.

Entity Browser: config/sync/entity_browser.browser.media_entity_browser_media_library.yml

uuid: 1388464a-abad-4f86-a5ba-f1c7591a8eae
langcode: en
status: true
dependencies:
  config:
    - views.view.media_entity_browser_media_library
  module:
    - entity_browser_entity_form
    - views
_core:
  default_config_hash: cVce1wq8rNNcosWnMLyjsjNUGYhJ9bVMZ-whh77pIdo
name: media_entity_browser_media_library
label: 'Media Entity Browser (Media Library)'
display: iframe
display_configuration:
  width: '1070'
  height: '500'
  link_text: 'Select media'
  auto_open: true
selection_display: no_display
selection_display_configuration: {  }
widget_selector: tabs
widget_selector_configuration: {  }
widgets:
  552cfb05-063f-47a9-81d1-e1260fc8a402:
    settings:
      view: media_entity_browser_media_library
      view_display: media_browser_all
      submit_text: 'Select media'
      auto_select: false
    uuid: 552cfb05-063f-47a9-81d1-e1260fc8a402
    weight: -9
    label: 'Choose existing media'
    id: view
  7e4422b4-dbe9-40f6-9b74-e2bf31b98ae8:
    settings:
      entity_type: media
      bundle: image
      form_mode: default
      submit_text: 'Save image'
    uuid: 7e4422b4-dbe9-40f6-9b74-e2bf31b98ae8
    weight: -10
    label: 'Upload new image'
    id: entity_form

Entity embed: config/sync/embed.button.media_entity_embed.yml

uuid: 599e7a38-835a-482b-a415-1a69627dff00
langcode: en
status: true
dependencies:
  config:
    - core.entity_view_mode.media.wysiwyg_full_width
    - core.entity_view_mode.media.wysiwyg_half_width
    - entity_browser.browser.media_entity_browser_media_library
    - media.type.image
  module:
    - entity_embed
    - media
_core:
  default_config_hash: uDFr71znDwk7GjuKOoGMVNXOEuC0_cse0NdhYARcWu0
label: 'Media Entity Embed'
id: media_entity_embed
type_id: entity
type_settings:
  entity_type: media
  bundles:
    - image
  display_plugins:
    - 'view_mode:media.wysiwyg_full_width'
    - 'view_mode:media.wysiwyg_half_width'
  entity_browser: media_entity_browser_media_library
  entity_browser_settings:
    display_review: false
icon_location: path
icon_uuid: null
icon_path: /core/modules/ckeditor/js/plugins/drupalimage/icons/drupalimage.png

The view is the default view provided by Core Media Library.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

scott_euser created an issue. See original summary.

scott_euser’s picture

Okay I have investigated further and it seems within Entity Embed, filters are being applied using a value instead of leaving blank:

View Query within Entity Embed for Media Library

SELECT 
  media_field_data.langcode AS media_field_data_langcode, 
  media_field_data.created AS media_field_data_created, 
  media_field_data.name AS media_field_data_name, 
  media_field_data.mid AS mid 
FROM 
  media_field_data media_field_data 
WHERE 
  (media_field_data.status = '0') 
  AND (media_field_data.name LIKE '%%' ESCAPE '\\') 
ORDER BY 
  media_field_data_created DESC, 
  media_field_data_name DESC 
LIMIT 25 
OFFSET 0

View Query outside of Entity Embed for general image field using Media Library

SELECT 
  media_field_data.langcode AS media_field_data_langcode, 
  media_field_data.created AS media_field_data_created, 
  media_field_data.name AS media_field_data_name, 
  media_field_data.mid AS mid 
FROM 
  media_field_data media_field_data 
ORDER BY 
  media_field_data_created DESC, 
  media_field_data_name DESC 
LIMIT 25 
OFFSET 0

Temporary solution to this is removing the Status filter from the default Media Library view (assuming it isn't required by your project).

scott_euser’s picture

Adding related issue https://www.drupal.org/project/drupal/issues/3053667 as once this is solved, the styling for Media Library does not work so a bit more needs to be done to get the full experience working well.

oknate’s picture

I would think this is an Entity Browser issue, not Entity Embed?

scott_euser’s picture

No, entity browser is not being used. Core media library from drupal core 8.7 release is being used. It works fine elsewhere but when loading media library within entity embed in ckeditor, it does not work.

oknate’s picture

Project: Entity Embed » Entity Browser
Component: CKEditor integration » Core API

I can see from your config entity_browser is being used. Also, entity embed doesn't have native view or media library selection without using entity browser. I'm going to move this to the Entity Browser issue queue, and I'll try to take a look this weekend and see if I can recreate the bug.

oknate’s picture

Version: 8.x-1.x-dev » 8.x-2.1

Are you using Entity Browser version 8.x-2.1?

Core doesn't have a view with the id media_entity_browser_media_library. It looks like you're using media_entity_library module, which provides an entity browser and view that matches the name of the view in your config.

So, it could be a bug in media_entity_browser, entity_browser and not very likely, in entity_embed.

oknate’s picture

Title: List of media in CK Editor Media Entity Embed no longer shows in entity embed after upgrading to core 8.7.x » Media in Media Entity Browser no displaying after upgrading to core 8.7.x
oknate’s picture

Title: Media in Media Entity Browser no displaying after upgrading to core 8.7.x » Media in Media Entity Browser doesn't display after upgrading to core 8.7.x
scott_euser’s picture

Ah okay, sorry! Not quite sure how the pieces all fit together. Thank you!

scott_euser’s picture

Are you using Entity Browser version 8.x-2.1?

Yes, 2.1.0 from my composer.lock

            "name": "drupal/entity_browser",
            "version": "2.1.0",
            "source": {
                "type": "git",
                "url": "https://git.drupalcode.org/project/entity_browser.git",
                "reference": "8.x-2.1"
            },
Andy-vv’s picture

I will add a comment to this issue, it may be helpful. I am using Entity Browser 2.1 and Drupal 8.7.3. I have just noticed that there is a difference between what the "Administrator" Role sees and what an "editor" role sees. Basically, the Administrator sees the complete updated entity list when using an inline browser. The editor role only sees items that were uploaded before May.
In order to get around the issue I have had to give the editor role the permission "Administer Media" via the UI (Screenshot below). I am uncomfortable with this, it has security implications, and does not seem like something that should be necessary simply to view the media list in the in-line entity browser.

Andy-vv’s picture

StatusFileSize
new36.12 KB
romulasry’s picture

Version: 8.x-2.1 » 8.x-2.x-dev

I have this issue in Drupal 9: pantheonsite.io with composer.

romulasry’s picture

anybody’s picture

Status: Active » Closed (outdated)