Problem/Motivation

A component used through a field formatter cannot get content in its slots from the Config panel. "Add content" fails with a TypeError in ComponentFormBase::announceValues(), and the formatter settings come back empty on reload.

The panel builds the source form from the form state values, which are empty after a button limiting validation, and saves raw values: the root form has no #tree, button values are kept, and a save without trigger runs the first button of the form.

Steps to reproduce

1. Use Display builder on an entity view display and set the Body field to "Component per item (UI Patterns)".
2. Pick a component with a slot, then click "Add content".

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

just_like_good_vibes created an issue. See original summary.

just_like_good_vibes’s picture

Assigned: just_like_good_vibes » pdureau
Status: Active » Needs review
pdureau’s picture

Assigned: pdureau » just_like_good_vibes
Status: Needs review » Needs work
Issue tags: +display_builder-1.0.0-beta8

✅ The fix is unblocking the access to the slot inline modal

But I am now seeing something wrong in inline form updates (maybe not introduced by this change, just hidden before and now visible)

Setup:

  1. In Display Builder, I add a Field source and I open the contextual form
  2. I pick "Component per item" as field formatter
  3. I pick my component
  4. I open a slot details

Add a widget source (so without opening a modal):

  1. I click on "Add content"
  2. ✅ The modal open with WYSIWYG as default source
  3. I type in the textarea and change focus
  4. ✅ The preview is automatically updated with what i typed
  5. I save
  6. ✅ The preview still OK

Inside an inline modal, the preview behavior change according to the source:

Source On source load (nice to have) Live update (nice to have) Update on Save button (mandatory)
WYSWYG Link ✅ updated ✅ updated ✅ kept
Entity Link ✅ empty ⚠️ still empty ❌ still empty
Field label ✅ updated Not applicable ✅ kept
Field item ✅ empty Not applicable ✅ kept
Component ⚠️ not updated ⚠️ not updated ❌ not updated
Icon ✅ empty ⚠️ not updated ❌ not updated

We have similar behavior with "Cancel" button, but it may be just another effect of the same cause.

What do we do? We try to fix this second part here? Or we do a follow-up?

pdureau’s picture

Assigned: just_like_good_vibes » mogtofu33
Status: Needs work » Reviewed & tested by the community

RTBC finally, because the issue I met seems to be this existing one : #3554416: Remove Update button from ContextualFormPanel

I will copy my test results there.

mogtofu33 made their first commit to this issue’s fork.

mogtofu33’s picture

Assigned: mogtofu33 » Unassigned
Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.