From b8aea06ffd043dbf9f161880fe21f1fa3bd131b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?benjamin=20melan=C3=A7on?= Date: Mon, 12 Nov 2018 22:49:49 -0500 Subject: [PATCH] Print only the title paragraph --- .../pattern-title-paragraph.html.twig | 39 +++++-------------- 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/agaric/templates/patterns/title_paragraph/pattern-title-paragraph.html.twig b/agaric/templates/patterns/title_paragraph/pattern-title-paragraph.html.twig index c799d02..0837dea 100644 --- a/agaric/templates/patterns/title_paragraph/pattern-title-paragraph.html.twig +++ b/agaric/templates/patterns/title_paragraph/pattern-title-paragraph.html.twig @@ -1,51 +1,30 @@ {# /** * @file - * Default theme implementation to display a one-column layout. + * Default theme implementation to display a pargraph section. * - * Available variables: - * - content: The content for this layout. - * - attributes: HTML attributes for the layout
. + * It extracts the title paragraph, if any, from a body paragraphs listing. * * @ingroup themeable */ #} -{{ dump(_context|keys) }} -
- -{% set bundle = content['#node'].bundle %} -{% set classes = [ 'is-child', 'card', 'card-project', 'hero-' ~ bundle|replace({"_": "-"}) ] %} -{# expected if statement would go here #} -{% set classes = classes|merge([ 'is-berry' ]) %} {% set title_paragraph_index = null %} {% set has_title_paragraph = false %} -{% if title.field_body_paragraph %} - Finally - {% for i, paragraph in title.field_body_paragraph if i|first != '#' %} - {% if title.field_body_paragraph['#items'][i].entity.type.0.entity.id == 'title' %} +{% if paragraphs.field_body_paragraph %} + {% for i, paragraph in paragraphs.field_body_paragraph if i|first != '#' %} + {% if paragraphs.field_body_paragraph['#items'][i].entity.type.0.entity.id == 'title' %} {% set has_title_paragraph = true %} {% set title_paragraph_index = i %} - Wow - {{ paragraph }} +
+ {{ paragraph }} +
{% endif %} {% endfor %} {% endif %} {% if not has_title_paragraph %} - - {# Header hero region #} -
-
- {{ content.title }} - buuuut you do have a title paragraph -
-

- {{ subtitle }} -

-
- + {% endif %} -