Adding media via entity reference fields does not take you to the EmbedSelectForm

Created on 14 December 2023, over 1 year ago
Updated 29 March 2024, about 1 year ago

Problem/Motivation

I can't access the EmbedSelectForm when adding media to an entity via an entity reference field, which means I can't change the image style or select auto/manually update for media added this way.

I'm able to select the Embed style from the Manage Display page, which would be used for all assets using this view mode. I'm trying to change the Embed style for individual assets.

Steps to reproduce

Drupal 10.0.3
Acquia DAM 1.0.11
PHP 8.1.8

  1. Enable media library.
  2. Update a text format to allow Embed media and add the Drupal Media button to the wysiwyg toolbar.
  3. Create a content type with a formatted text field.
  4. Add a node.
  5. In the wysiwyg, use the Drupal Media button to add media to the text field.
  6. In the media library modal, note the "Next: Select Format" button.
  7. Select media and click the Next button to submit.
  8. You are taken to the Format options (EmbedSelectForm) where you can select the image style and Auto/manually update the version.

This behavior is good.

Then

  1. Create a content type with a Media entity reference field.
  2. Add a node.
  3. Add media.
  4. You get the standard media library modal with the "Insert selected" button. I was expecting to see the Next: Select Format button.
  5. Select media and click Insert Selected.
  6. Your media is added, but you never hit the EmbedSelectForm.

The acquia_dam ajax callback is not being used. This line is false because, in this case, $query is media_library.opener.field_widget' and not 'media_library.opener.editor'.
if ($query === 'media_library.opener.editor' && $source === 'acquia_dam') {

Is that expected behavior or am I just missing some config somewhere to make it behave the same?

Proposed resolution

Add a check to include media_library.opener.field_widget
str_contains?
if (str_contains($query, 'media_library.opener') && $source === 'acquia_dam') {

or more explicitly add an OR statement?

Remaining tasks

Determine if this is by design. Should those 2 methods of adding media function differently?

User interface changes

Adding media with an entity reference field will use the Next: Select Format button on the media library modal.

✨ Feature request
Status

Postponed

Version

1.0

Component

User interface

Created by

πŸ‡ΊπŸ‡ΈUnited States capysara

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024