Problem/Motivation
When using Field formatter source with an entity Label, the checkbox `Link label to the referenced entity` is checked, if uncheck will not be saved in config.
Only a manual import of config will save the 'uncheck version'.
Same for Field formatter, layout builder or Display Builder.
Steps to reproduce
On an entity display like articles with tags.
Set field_tags to component, pick a component with a slot
In component slot set "[Field] Formatter", Formatter: Label
Uncheck Link label to the referenced entity
Save
Go back, the link is checked again.
Config saved is:
slots:
label:
sources:
-
source_id: 'field_formatter:node:article:field_tags'
source:
type: entity_reference_label
settings:
link: true
_weight: '0'
third_party_settings: ''
node_id: ''
If set link to false and import config, result is ok.
Go to the display, see Link label to the referenced entity is not checked.
Save
Then it is a link again
Check config, the settings is not there anymore.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork ui_patterns-3607927
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
Comment #2
mogtofu33 commentedComment #3
smovs commentedComment #5
smovs commentedHey team!
I fixed the issue when link label to the referenced entity was not saved. Please review
The issue was:
ComponentSlotForm::afterBuild()discarded the return value ofparent::afterBuild(), so a slot element's#valuekept the raw POST data instead of the processed form values, and whenComponentForm::elementValidate()wrote that back over the whole ui_patterns subtree it erased everything the browser doesn't submit, including unchecked checkboxes like "Link label to the referenced entity"Comment #6
mogtofu33 commentedComment #7
just_like_good_vibesHello here :)
that fix looks/seems necessary and nice.
please ping the issue to me @mogtofu33 after your review.
all the best
Comment #8
just_like_good_vibesafter #3618440: [task] add Playwright end-to-end tests to the pipeline will land in the codebase, i will probably add a new playwright test in addition to this work.
so let's wait for the playwright issue to be merged first.
Comment #10
just_like_good_vibeshello guys, i have added the test for that specific use case and validated the fix from @smovs (thanks :) )
we could have added only a functional test for this use case (and phpunit would have allowed to test against different core versions if needed), but i have preferred to add a few lines to the existing field_formater playwright tests, so we don't have to pay the fixed cost of a new functional test and that new test cost less time in the pipeline.
new merge request is https://git.drupalcode.org/project/ui_patterns/-/merge_requests/541
Comment #12
just_like_good_vibes