Pregunta

I have a paragraph type called News. In this paragraph type I have a text field (field_news_intro ) with a summary. How do I display the summary in a twig template?

content.field_news_intro.summary seemed logical, but it doesn't return anything.

My template is called paragraph--news.html.twig

<div class="copy larger">
  {{ content.field_news_intro.summary }}
</div>
<div class="copy">
  {{ content.field_news_intro }}
</div>
¿Fue útil?

Solución

you can get the summary with summary attribute in field level.

{{ content.YOUR_FIELD_NAME['#items'][0].summary }} 

in your case answer will be :

{{ content.field_description['#items'][0].summary }} 
Licenciado bajo: CC-BY-SA con atribución
No afiliado a drupal.stackexchange
scroll top