Score:0

How to render fields in nested paragraphs?

in flag

I'm trying to create a paragraph that will allow me to display several children's paragraph fields.

I added the children-paragraph to the parent paragraph via Entity reference revisions.

I created 3 template files in order to render my entities: paragraph--parent-paragraph.html.twig, paragraph--child-paragraph.html.twig and field--field-child-paragraph-reference.html.twig

With the children referenced, I then attempted to use the reference template (field--field-child-paragraph-reference) where I had access to all children. It all works well until I try to get specific fields from the entity.

I looked this up using kint/dsm and they appear protected.

I need to be able to access those fields where I have access to all the children so I can use parts of children for parts of the display.

This is from field_child_reference.html.twig here

This is dsm output from parent paragraph template. The child fields are also protected in the child reference template.

This is from paragraph_child

This is dsm output from child paragraph template I want to be able to render the fields from the second image in field-child-reference.html.twig

How to proceed?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.