From 29f7fce47f4607613ea6adad4b65a2589e48b7e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?benjamin=20melan=C3=A7on?= Date: Mon, 21 Jan 2019 00:30:47 -0500 Subject: [PATCH] Print only the first *text* paragraph --- .../field--field-body-paragraph--rss-teaser.html.twig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/agaric/templates/field/field--field-body-paragraph--rss-teaser.html.twig b/agaric/templates/field/field--field-body-paragraph--rss-teaser.html.twig index 4ce44cf..3d0dbe6 100644 --- a/agaric/templates/field/field--field-body-paragraph--rss-teaser.html.twig +++ b/agaric/templates/field/field--field-body-paragraph--rss-teaser.html.twig @@ -34,11 +34,17 @@ * - label_display: The display settings for the label. * * @see template_preprocess_field() + {% for i, paragraph in content.field_body_paragraph if i|first != '#' %} */ #} -{% for item in items %} - {{ item.content|render|escape }} +{% set one_and_done = false %} +{% for item in items if not one_and_done %} +{{ item.content['#paragraph'].type.0.entity.id }} + {% if item.content['#paragraph'].type.0.entity.id == 'text' %} + {% set one_and_done = true %} + {{ item.content|render|escape }} + {% endif %} {% endfor %} {# the closing description tag is found in the RSS view template so that we can add a Read more link — we don't have the node information to make it here!