Unable to save with required media field

Created on 16 August 2021, over 3 years ago
Updated 10 September 2023, over 1 year ago

Hello,

After updating my drupal core to the last version, I encount a problem on saving contents using gutenberg with media field mapped.

Problem/Motivation

With a media field mapped to the gutenberg editor like this :
["drupalmedia/drupal-media-entity", {"mappingFields": [{"field": "field_front_image", "property": "target_id", "attribute": "mediaEntityIds"}]}],

When I try to save the content, it generate an error that say "the field xyz is required". I tried to remove the existing picture and reselect it without success. I tried with a new content and same problem. Like if the editor doesn't detect that the field is already filled.
If I set the field as not required, all is ok, I can save the content, and the media (picture) is displayed correctly on the final content.

When editing the block in gutenberg, the "field mapping" information say to me : The block attribute mediaEntityIds is mapped to the field_front_image[target_id] field.

Steps to reproduce

I don't know if it's possible to reproduce it.

Is anyone encounting the same problem ? It seems the field mapping syntax is correct, refering at https://www.drupal.org/docs/8/modules/gutenberg/field-mapping

Thanks in advance for any suggestion.

🐛 Bug report
Status

Active

Version

2.0

Component

User interface

Created by

🇨🇭Switzerland titouille

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇬🇧United Kingdom RogerB Greenwich, London

    Also encountering this issue but my field is not mapped to a Gutenberg editor template block. Unable to save a new node that has a media field or image field, required or not.

    Work around is to disable the 'Gutenberg experience' on the content type, create the new content item with image, save it, then re-enable Gutenberg on the content type. Editing then works fine, even replacing the image with another.

    Very keen to use the Gutenberg editor on a client's site but this is not possible while this problem persists.

Production build 0.71.5 2024