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

  1. Create a paragraph type called 'card' with a 'field_heading' text field.
  2. Create a paragraph type called 'grid' with a 'field_paragraphs' reference field and a 'field_columns' number field.
  3. Create a content type called 'page' with a 'field_paragraphs' reference field.
  4. 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.

Command icon 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

d.fisher created an issue. See original summary.

d.fisher’s picture

Issue summary: View changes
d.fisher’s picture

Assigned: d.fisher » Unassigned
Status: Active » Needs review

MR!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.

naveko’s picture

Hi Darren,

Thanks for your work! I've tested it and it's working as expected. Your contribution is available in 8.x-1.7.

naveko’s picture

Status: Needs review » Fixed

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

d.fisher’s picture

That's great. Thank you for reviewing and releasing this quickly!!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

d.fisher’s picture

@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.

patrickscheffer’s picture

@d.fisher I've checked and saved your name on the contributors tab, will this do?

d.fisher’s picture

Thank you. Yes that's the new way to do it I think!! Much appreciated!