Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
'Collapse' action does validation for whole form, that is not what we want. Check how 'Duplicate' works.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#14 | collapse_button-2867385-14.patch | 3.69 KB | Ginovski |
#14 | interdiff-2867385-11-14.txt | 1.09 KB | Ginovski |
#11 | interdiff-2867385-6-11.txt | 1.53 KB | hkoch |
#11 | collapse_button_does-2867385-11.patch | 2.6 KB | hkoch |
Comments
Comment #2
tbonomelli CreditAttribution: tbonomelli at MD Systems GmbH commentedComment #3
tbonomelli CreditAttribution: tbonomelli at MD Systems GmbH commentedAdded limit_validation_errors to the collapse button.
Comment #5
tbonomelli CreditAttribution: tbonomelli at MD Systems GmbH commentedRemoved now unnecessary lines of code which caused the test to fail.
Comment #6
tbonomelli CreditAttribution: tbonomelli at MD Systems GmbH commentedReadded the removed code lines and altered them so they don't fail anymore.
Instead of validating the form with the Collapse button it uses the 'save and keep published' button.
Comment #7
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedOk, tested this a bit,... and if we remove this validation, we allow saving of entities that are missing required fields. This is definitely not what we want.
I was thinking a bit about other possible solutions, but I don't see one, so I am inclined to the idea to close this issue if we don't have other proposals.
Comment #8
toncic CreditAttribution: toncic at MD Systems GmbH commentedWe should have the same functionality as a duplicate button.
I tested a little bit with this
'#limit_validation_errors' => [array_merge($parents, [$field_name, 'add_more'])],
and seems works properly.
Comment #9
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedMeh, ... somehow I managed to overlook that we in fact want to validate just the current paragraph, @toncic is right. Ignore my previous comment :P
Comment #10
miro_dietikerPromoting since i have seen severe ux issues with users fighting against required field errors while they want to interact with adding / removing / editing=expand|collapse elements..
Comment #11
hkoch CreditAttribution: hkoch as a volunteer commentedApplied suggestion from comment #8
Comment #13
miro_dietikerDrupal\paragraphs\Tests\Classic\ParagraphsAdministrationTest 507 passes 1 fails
Comment #14
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commentedFixed the administration test.
Comment #16
miro_dietikerVery nice. Committed.
One content editor pain less, party!
:-)
Comment #18
miro_dietikerOops, attributed the wrong person for patch creation, thus pushed a second empty commit. :-)