Problem/Motivation
If you have nested paragraphs it is not possible to use them with this module. Here is an example of my template:
page:
landing-page-converter:
label: Landing page converter
default: false
fields:
field_paragraphs:
- type: grid
field_heading: "This is perfect for:"
field_paragraphs:
- type: card
field_heading: "Persona One"
- type: card
field_heading: "Persona Two"
- type: card
field_heading: "Persona Three"
field_columns: 3
Steps to reproduce
- Create a paragraph type called 'card' with a 'field_heading' text field.
- Create a paragraph type called 'grid' with a 'field_paragraphs' reference field and a 'field_columns' number field.
- Create a content type called 'page' with a 'field_paragraphs' reference field.
- Paste the above example or other similar example with nested paragraphs and observe the cards don't get created when using this module normally.
Proposed resolution
Implement a recursive strategy when creating paragraphs in instances where nesting occurs.
Remaining tasks
OP to create a branch and MR with proposed resolution.
User interface changes
N/A
API changes
N/A
Data model changes
Will now use recursion to process paragraphs.
Comments
Comment #3
d.fisher commentedComment #4
d.fisher commentedMR!4 solves the problem.
You can test the changes with composer patches and the following url:
https://git.drupalcode.org/project/node_form_templates/-/merge_requests/...
Unassigning myself and marking as needs review.
Comment #5
naveko commentedHi Darren,
Thanks for your work! I've tested it and it's working as expected. Your contribution is available in 8.x-1.7.
Comment #6
naveko commentedComment #8
d.fisher commentedThat's great. Thank you for reviewing and releasing this quickly!!
Comment #10
d.fisher commented@naveko sorry to ask, but any chance you can update the contribution record on this? Every recognition of contribution helps me make the case to my company to do open source work as it credits them too! Thanks in advance.
Comment #11
patrickscheffer commented@d.fisher I've checked and saved your name on the contributors tab, will this do?
Comment #12
d.fisher commentedThank you. Yes that's the new way to do it I think!! Much appreciated!