-2

I have a paragraph called User Info and inside that there are two fields:

  1. field_test (Text field)
  2. field_para_text_title (Paragraph field) enter image description here Both the field values are printing when I print {{ content }} in paragraph--user-info.html.twig.

But I could not print field_para_text_title field alone like below:

{{ content.field_para_text_title }}

nothing giving for field_para_text_title but {{ content.field_test }} is working fine.

  • Is the nested paragraph enabled in the view mode of your paragraph type? /admin/structure/paragraphs_type/YOUR_PARAGRAPH_TYPE/display – Hudri Jul 31 '18 at 14:31
  • @Hudri, yes it is enabled and if I print {{ content }} it is showing. – ARUN Jul 31 '18 at 14:36
  • Hmm, I have a similar thing I just set up. It is a paragraph with the ability to add a sidebar to it. I used {{ content.field_sidebar }} to get the embedded paragraph. Does your field allow for more than 1 additional paragraph? You may need to loop thru and use content.field_para_text_title[n]. Also what does a dump of the content keys and the content.field_para_text_title give you? – CG Monroe Jul 31 '18 at 17:11
  • I tried with content.field_para_text_title[0] but no luck. Is it working for you? – ARUN Aug 1 '18 at 3:11
  • Hi, Did you get solution for this? Even, I am facing the same issue. Should we try to preprocess the field paragraph? If so, how can we get those alues inside the parent paragraph.twig – Kiran Nov 28 '18 at 6:54
-2

Have you tried: {{ content.field_field_para_text_title.0 }} or, if that doesn't work, I would try:

  • Create a template file for your paragraph field. So it would be paragraph--field-field_para_text_title.html.twig

    In paragraph--field-field_para_text_title.html.twig you do: {{ content.field_field_para_text_title }}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.