If you create a required field on the paragraph entity, and make the paragraph collapsible on the parent node (or entity), the user can add a paragraph entity without filling in the required field, collapse the paragraph, and save the node (or entity). Marked as critical as site functionality should be able to depend on required fields not being empty.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | paragraphs-validate_on_collapse-2612120-9.patch | 3.81 KB | karlshea |
| #9 | paragraphs-validate_on_collapse-tests-2612120-9.patch | 3.18 KB | karlshea |
Comments
Comment #2
WebbehIsn't this a copy of https://www.drupal.org/node/2558517 ?
Comment #3
matthijsI can confirm this issue, the attached patch fixes this by validating the submitted values on collapse.
Comment #4
matthijsMy previous patch changed the wrong form builder property, here's a new one :-)
Comment #5
gadaniels72 commentedThis is a different issue than https://www.drupal.org/node/2558517; in that issue, the requiredness of a paragraph item is not validated as required (so if I add a field "test" of type "paragraphs" and make it required, it does not throw an error if I do not add a paragraph item. This issue happens when one has a required field within the paragraph bundle (for example, paragraph bundle "p-test" has a required field of "label." If I add a field "test" of type "paragraphs" and set the open type to "preview" and then press "add paragraph item" and "collapse" and save, the p-test field is not actually required.
Comment #6
gadaniels72 commentedTested the patch #4 and it does work. To test, I:
Comment #7
jeroen.b commentedThanks @Matthijs and @gadaniels72 for putting effort and time into this!
I'm currently trying to get the quality of the code up to par with the D8 version.
That mostly just means we need to add many tests to make sure we won't break anything.
Are you able to create a unit test for this? (and provide 2 patches: 1 with the fixed code + test, 1 with the test only. that way we can see the test actually confirms it is fixed now).
Comment #8
jeroen.b commentedComment #9
karlsheaTests added
Comment #12
karlsheaTest failures are due to #2729173-2: Undefined property while creating new content, not anything to do with Paragraphs.
Comment #13
karlsheaComment #14
emmanvazz commentedPatch #4 worked for me as well. Thanks!
Comment #15
emmanvazz commented@KarlShea seems like #2807275 is fixed, now to wait for Entity API to get updated.
Comment #16
finex commentedHi, the same bug exists on D8 version.
Comment #17
whthat commentedRe-queued tests from Patch #9 with success! Entity API patch has been committed #2807275
Comment #18
whthat commentedComment #19
supriya1992 commentedHi,
please refer issue: https://www.drupal.org/project/paragraphs/issues/3065680
Comment #20
supriya1992 commentedComment #21
WebbehUnassigning supriya1992 from the issue.
Comment #22
WebbehThe patch supplied in #4 worked well for me, and appears to have worked for folks given #14, #17, #6, so I'm marking this as reviewed & tested pending any major hiccups.
Comment #23
WebbehAttaching D8 version of this issue as a related task.
Comment #24
WebbehComment #26
jstollerPatch committed to dev.