DANSE settings for content always use the defaults (AJAX forms)

Created on 4 April 2024, 8 months ago
Updated 20 April 2024, 7 months ago

Problem/Motivation

You create a node for a specific content type and want to use DANSE to deliver that event. The settings for the DANSE options on the New Content UI are always overridden by the defaults specified for the content type when the form have at least one AJAX field populated. The same goes for edit events, publish events and so on.

The entity form can be cached when the AJAX field is filled. When submitted, the build phase is not executed because form is retrieved from the cache. The hook_form_alter is not called, the entity ID is not added to the static property $processedEntitiesByUi of the content plugin, the event is then created with the defaults.

Steps to reproduce

Create a content type with an AJAX field. For example, a media entity reference field with the media library widget.

Configure defaults DANSE settings for this content type.

Now, create a node for this type by filling the AJAX field and use DANCE options different from the defaults.

Proposed resolution

Move the update of the static property $processedEntitiesByUi from the build phase to the process phase using an #entity_builders form callback. This type of callback is always called when the entity is built with submitted values right after submission and before saving the entity.

🐛 Bug report
Status

Fixed

Version

2.3

Component

Code

Created by

🇫🇷France Thomas Bosviel

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