DANSE settings for content always use the defaults (AJAX forms)
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3438076. -->
Reported by: [thomas bosviel](https://www.drupal.org/user/1141638)
Related to !15
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>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 <code>New Content</code> UI are always overridden by the defaults specified for the content type when <strong>the form have at least one AJAX field</strong> populated. The same goes for edit events, publish events and so on.</p>
<p>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 <code>hook_form_alter</code> is not called, the entity ID is not added to the static property <code>$processedEntitiesByUi</code> of the content plugin, the event is then created with the defaults.</p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<p>Create a content type with an AJAX field. For example, a media entity reference field with the media library widget.</p>
<p>Configure defaults DANSE settings for this content type.</p>
<p>Now, create a node for this type by filling the AJAX field and use DANCE options different from the defaults.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Move the update of the static property <code>$processedEntitiesByUi</code> from the build phase to the process phase using an <code>#entity_builders</code> 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.</p>
issue