From 593842d2d73cc603daa2699aec3e932018a8a6f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?benjamin=20melan=C3=A7on?= Date: Mon, 12 Nov 2018 22:13:38 -0500 Subject: [PATCH] Let's call the pattern what it is --- .../patterns/tile/pattern-tile.html.twig | 14 ++++----- .../patterns/tile/tile.ui_patterns.yml | 30 ------------------- .../tile/title_paragraph.ui_patterns.yml | 16 ++++++++++ 3 files changed, 22 insertions(+), 38 deletions(-) delete mode 100644 agaric/templates/patterns/tile/tile.ui_patterns.yml create mode 100644 agaric/templates/patterns/tile/title_paragraph.ui_patterns.yml diff --git a/agaric/templates/patterns/tile/pattern-tile.html.twig b/agaric/templates/patterns/tile/pattern-tile.html.twig index 161aa42..c799d02 100644 --- a/agaric/templates/patterns/tile/pattern-tile.html.twig +++ b/agaric/templates/patterns/tile/pattern-tile.html.twig @@ -10,12 +10,10 @@ * @ingroup themeable */ #} - -{% if content %} +{{ dump(_context|keys) }}
- {% set bundle = content['#node'].bundle %} {% set classes = [ 'is-child', 'card', 'card-project', 'hero-' ~ bundle|replace({"_": "-"}) ] %} {# expected if statement would go here #} @@ -23,11 +21,13 @@ {% set title_paragraph_index = null %} {% set has_title_paragraph = false %} -{% if content.field_body_paragraph %} - {% for i, paragraph in content.field_body_paragraph if i|first != '#' %} - {% if content.field_body_paragraph['#items'][i].entity.type.0.entity.id == 'title' %} +{% 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' %} {% set has_title_paragraph = true %} {% set title_paragraph_index = i %} + Wow {{ paragraph }} {% endif %} {% endfor %} @@ -49,5 +49,3 @@ {% endif %}
- -{% endif %}{# content #} diff --git a/agaric/templates/patterns/tile/tile.ui_patterns.yml b/agaric/templates/patterns/tile/tile.ui_patterns.yml deleted file mode 100644 index 25f9bc5..0000000 --- a/agaric/templates/patterns/tile/tile.ui_patterns.yml +++ /dev/null @@ -1,30 +0,0 @@ -tile: - label: Tile - description: A small teaser linking to content from a list displayed as a grid. - variants: - default: - label: Default - description: A plain tile. - berry: - label: Berry - description: A purple-colored tile. - cinnamon: - label: Cinnamon - description: An orange-colored tile. - blue: - label: Blue - description: A blue-colored tile. - marine: - label: Marine - description: A blue-green tile. - fields: - title: - type: text - label: Title - description: Tile title. - preview: ACME Dynamite - subtitle: - type: text - label: Subtitle - description: Tile subtitle. - preview: An explosive web site diff --git a/agaric/templates/patterns/tile/title_paragraph.ui_patterns.yml b/agaric/templates/patterns/tile/title_paragraph.ui_patterns.yml new file mode 100644 index 0000000..a35a5b4 --- /dev/null +++ b/agaric/templates/patterns/tile/title_paragraph.ui_patterns.yml @@ -0,0 +1,16 @@ +title_paragraph: + label: Title paragraph + description: Extract the title paragraph, if any, from a body paragraphs listing. + fields: + paragraphs: + type: text + label: Title paragraph + description: Accepts a paragarph field; outputs only the title paragraph. + preview: ' +
+
+
+

DRTB Network

+

Community directory

+
+
'