Allow to re-save existing referenced entity

Created on 27 November 2024, 25 days ago

Problem/Motivation

The Media Widget module, which defines media reference field widgets mimicking core's File upload and Link widgets, includes an ugly hack (see here and here) to work around a problem happening when submitting the entity form with an existing media item.

When creating a new media item, the submission will work just fine, since the entity reference field supports automatically saving new referenced entities, however it does not currently support re-saving existing referenced entities. As a consequence, when submitting the entity form, if any media field value was updated (e.g. if the "alt" media field value was changed), there is no way for the save to happen as part of referencing entity save transaction. This in turn means that, if either the referencing entity save or the media entity save fail, an inconsistent state can result.

Proposed resolution

Add support to optionally re-save a referenced entity when saving the referencing entity.

Remaining tasks

Validate the proposed solution
Write code
Perform reviews

User interface changes

None

Introduced terminology

None

API changes

None, only API additions

Data model changes

None

Release notes snippet

TBD

Feature request
Status

Active

Version

11.1 🔥

Component

field system

Created by

🇮🇹Italy plach Venezia

Live updates comments and jobs are added and updated live.
  • API addition

    Enhances an existing API or introduces a new subsystem. Depending on the size and impact, possibly backportable to earlier major versions.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024