Print only the first *text* paragraph

This commit is contained in:
benjamin melançon 2019-01-21 00:30:47 -05:00
parent 183434e5ba
commit 29f7fce47f

View file

@ -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 != '#' %}
*/
#}
<description>
{% 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!