Cannot add new assets via the Entity Revision Asset Media Library widget

Created on 26 February 2024, 10 months ago
Updated 16 May 2024, 7 months ago

Problem/Motivation

The Entity Revision Asset Media Library widget displays the media library as expected, the media entity is created, but the media is not added to the node.

Steps to reproduce

On a new install
Drupal 10.1.9-dev (also tested in 10.2.3)
acquia_dam 1.0.x-dev
entity_reference_revisions 1.11.0 (Update: this issue does not appear to exist in 1.10, but is broken for 1.11)

Add and enable contrib entity_reference_revisions.
Edit Basic page content type.
* Add an Entity reference revisions field type called Media rev.
Under Media type, select all DAM media types and core Image media type (I'm not sure it should work with core Image media, but it's an option, so I tested it).
* Under Manage form display, select Entity Revision Asset Media Library widget.
* Add an Entity reference field type, called Media.
* Under Manage form display, select widget Media Library
Use default config for DAM media types
* Documents - Format: Embed Code with Embed style: initially displays "Original," so I selected Thumbnail linked to viewer with download and saved, see /admin/structure/media/manage/acquia_dam_documents_asset/display
* Image - Format: Embed Code with Embed style: Original, see /admin/structure/media/manage/acquia_dam_image_asset/display
* PDF - Format: Embed Code with Embed style: Thumbnail linked to viewer with download, see /admin/structure/media/manage/acquia_dam_pdf_asset/display
* Video - Format: Embed Code with Embed style: Inline viewer without download, see /admin/structure/media/manage/acquia_dam_video_asset/display

Create node of type Basic page
* Click Add media for Media rev field
* Select asset of type DAM - Image
* Click Insert selected
* Media is not added to node field
Repeat with DAM - PDF, DAM - Document, and DAM - Video
Click Add media for Media field
* Select asset of type DAM - Image
* Click Insert selected
* Media is added to node field
Repeat with DAM - Document and DAM - Video
Save node
Media is not added to node for Media rev field
Media is added to node for Media field, as expected

The behavior is the same for the Media rev field if you attempt to Set default value (/admin/structure/types/manage/page/fields/node.page.field_media_rev). No media is added after you Insert Selected.

I can add existing media entities using the Autocomplete widget, but only after the entity has been created.
Under Manage form Display for Media rev field, change widget to Autocomplete.
Edit node.
* Click Add media for Media rev field.
* The only options for Autocomplete are the media items that already have a media entity, so the user can't select a new asset.
* If you select an existing media entity, it adds it to the node as expected.

I tried this with Create new revisions for DAM - PDF both disabled (default) and enabled.
The entities are still created even when it fails to add the media to the node, see /admin/content/dam-media.
No errors in console or dblog.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

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