Closed (fixed)
Project:
Paragraphs
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
14 Jul 2015 at 09:25 UTC
Updated:
9 Mar 2016 at 15:57 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
janlaureys commented+1 subscribed
Sidenote: Normal fields like images, text, etc. ARE saved inside the first paragraph reference field. Only the nested paragraph fields are being ignored/thrown away, nesting paragraph reference fields is not breaking the whole thing.
Comment #2
christian.wiedemann commented+1 subscribed
Comment #3
duwid commented+1 subscribed
Comment #4
miro_dietikerBug or feature? ;-)
I'd say, this is more of a feature request to support nested paragraphs.
Paragraphs can be considered quite stable and we can release a 1.x version without this feature... And i'm not sure what complexity we need to resolve to support this request. It might be a big challenge or a simple fix finally...
Can someone provide a specific nice real life use case why this is needed?
Comment #5
luksakI think this is a very important feature for paragraphs which I used a lot in 7.x.
The use case is the following: Paragraphs is most commonly used as a tool to provide flexible content management providing some kind of building blocks. Let's assume the is one named "Accordion". Nested inside the "Accordion" Paragraph we need to be able to add "Accordion items" having a title and a content field.
Since this feature existed in 7.x isn't this a requirement for a 1.x release to reach feature parity?
Comment #6
jeroen.b commentedThe 8.x version should contain all the features of 7.x version as stated on the project page, so this is indeed a bug.
Comment #7
luksakOk. What is the issue here? Any idea how we could solve this? If I know where to start, I'll try to fix this.
Comment #8
jeroen.b commentedI did not research yet, but it should be somewhere in src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php.
Might be there is some array_parents issue somewhere.
Comment #9
jeroen.b commentedI have narrowed it down to the massageFormValues function.
The
|| !$form_state->isValidationComplete()prevents saving inside the embedded paragraph.Comment #10
jeroen.b commentedI think I fixed it by extracting/validating the subform again after the validation of the full form.
For some reason the massageFormValues is only called on the top level elements after the validation has been completed.
I'm not sure if I fixed this in the right place, please check @miro_dietiker and @Berdir.
Comment #11
jeroen.b commentedComment #12
luksakWorks perfectly for me. Thank you!
Comment #13
miro_dietikerDidn't check yet, but we especially also need to check the multilingual cases (currently broken due to a core change and paragraphs was needed to identify this core problem...) and write a test for this crazy stuff... ;-)
Comment #14
luksakI just lost nested paragraphs after reordering the parents. I added one at the bottom and dragged it to the top. After that the previously first paragraph lost it's children.
Comment #15
miro_dietikerComment #16
jeroen.b commentedCan you please try the attached patch? It should handle changing delta's correctly.
Comment #17
luksakLooking good so far... I was unable to reproduce the bug with this patch.
Comment #18
LKS90 commentedSeems to work with multilingual as well with this patch. Attached some screenshots. To make paragraphs work with multilingual setups again, #2543258: Entity references of untranslatable fields are not displayed in the correct translation needs to be reviewed/committed. Edit: Oh, and also entity_reference_revisions, I already have a patch for the current version of the core patch, but I'll wait until the core issue is fixed
before opening the issue to update entity_reference_revisions#2551365: Fix missing parameter for viewElements and getEntitiesToView The issue, postponed since we wait for the core issue.Comment #20
jeroen.b commentedPushed to dev!
Comment #21
jeroen.b commentedOh wait, still needs tests...
Comment #22
LKS90 commentedThis test is only meant to show that nested paragraphs work, the way the test sets them up is rather ugly and not meant as an example on how to do it (I create the paragraph type, add fields for text and entity_reference_revisions and set up the form display). I tried to use
$this->xpath('//p')to find the content, but the text itself is missing, might be useful though to count the existence of paragraphs (Check that the count is 4 in this test, for example).Comment #23
miro_dietikerI would recommend to test nested paragraphs with just unique text added to each paragraph and test it by example.
About setting up things: Doing so through the UI is pretty slow. The more common way is offer a dedicated test module that ships default config. Alternatively we could pack a nested paragraph setup into the demo and use the demo as a test setup as we do for some other tests. All we need would be a new nested paragraph type.
There is still that question pending about consistently deleting a node with its paragraphs. Did we take care of cascading deletes (or are we still not deleting the paragraphs at all?)
Comment #24
LKS90 commentedI have created an issue to add the 'Nested paragraphs' type to the paragraphs_demo module here: #2569483: Add nested paragraphs to paragraphs_demo. Writing a test should be way faster and easier then (basically just create a new paragraphed article, add some nested paragraphs and assertText the content, I think).
I'm not sure if the new issue is necessary, I could close this issue and add the tests with the new paragraph type, or add the paragraph type in this issue as well, I'm not sure. Feel free to decide for me :).
Edit: When I delete the node, the content is still in the database and the
deletedfield is not set to true.Comment #25
miro_dietikerThe delete issue ended up at the entity_reference_revisions module and is not yet committed: #2429335: Deletion of referenced entities
I'm adding a statement about recursion there... ;-)
Comment #26
miro_dietikerThis is not postponed, but successfully implemented in one of the referred issues above.