When using the new Media Library widget introduced in #3473148: Media Library widget.
It allows a user to add media entities via a media library widget.

Problem/Motivation

Using the Media Library submodule makes the custom field with Media Reference widget unusable when multiple rows can be added to the custom field.
All media items are replaced by the media item selected in the first row.
It's also not possible to remove the media from the items and replace them by the correct one.

Steps to reproduce

  1. When the extra module is enabled and a media field is added to a custom field. Custom field needs the possibility to add multiple items so 2 or more.
  2. Going to de entity with the custom field and tries to add media.
  3. First item everything works fine.
  4. Press "add item"
  5. New item appears, but the media item is already pre filled with the same media item as the first one.

Other scenario:

  1. When there is already a custom field with multiple rows with a media item.
  2. When pressing "add item"
  3. All media items are replaced by the media item selected in the first row.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

martijn de wit created an issue. See original summary.

apmsooner’s picture

Status: Active » Postponed (maintainer needs more info)

Thanks for notifying however I can't reproduce this issue for some reason. I'm on Drupal core 10.3.5 and tried to reproduce with simple setup of unlimited custom_field with the media library widget and am having no issues adding/removing items. Is there anything else you can provide about your setup that may help me identify the issue? What type of entity for instance is the field attached to?

apmsooner’s picture

Ahh, it looks like a multi-valued custom_field within a multi-valued paragraphs field might be the issue I'm seeing. If that is what you are encountering also, that appears to be a valid bug that I will have to look into a solution for.

apmsooner’s picture

Status: Postponed (maintainer needs more info) » Needs review

The patch should fix this issue. Please confirm with RTBC.

Thanks!

apmsooner’s picture

martijn de wit’s picture

Title: Using the Media Library submodule makes the custom field with Media Reference widget unusable when multiple rows can be added to the custom field. » Using the Media Library submodule makes the custom field with Media Reference widget unusable within a multi-valued custom_field.
Status: Needs review » Reviewed & tested by the community

Tested the merge request / patch.

Everything seems to work fine now!
Thank you for the quick response!

  • apmsooner committed 9df12a67 on 3.0.x
    Issue #3479170 by apmsooner: Using the Media Library submodule makes the...
apmsooner’s picture

Status: Reviewed & tested by the community » Fixed
apmsooner’s picture

Status: Fixed » Closed (fixed)