Showing posts with label paragraph link field render. Show all posts
Showing posts with label paragraph link field render. Show all posts

Thursday 17 June 2021

How to render nested paragraph field in drupal 8 paragraph twig?

It's a very easy way to render nested paragraph fields, we are going to explain with 2 methods for link field data.

Method 1: Suppose your paragraph(entity reference revisions) name is 'simple_card', so your file name will be "paragraph--simple-card.html.twig" and we have to render inner paragraph(entity reference revisions) link field data, so our approach will be...

{% for item in content.field_p_link['#items'] %}

{{ item.entity.field_link.uri }}

{% endfor %}


Method 2: Our second method will be direct one line code for this inner 'field_link' field data is...

{{ content.field_p_link['#items'].entity.field_link.uri }} 


// here field_p_link is the first paragraph revision field and field_link is a nested paragraph field.

Imp: Other text fields simply render by 

          {{ content.field_p_link['#items'].entity.field_first_name.value}} 


Note: If have any suggestions or issue regarding 'How to render nested paragraph field in drupal 8 paragraph twig?' then you can ask by comments. 

How to resolve max execution time error in drupal ?

When you found error regarding 'max_execution_time' exceed, then you can follow steps for resolve this error: Steps:   You can put t...