Let's call the pattern what it is

This commit is contained in:
benjamin melançon 2018-11-12 22:13:38 -05:00
parent 94f899bd23
commit 593842d2d7
3 changed files with 22 additions and 38 deletions

View file

@ -10,12 +10,10 @@
* @ingroup themeable * @ingroup themeable
*/ */
#} #}
{{ dump(_context|keys) }}
{% if content %}
<div class="column is-one-third"> <div class="column is-one-third">
{% set bundle = content['#node'].bundle %} {% set bundle = content['#node'].bundle %}
{% set classes = [ 'is-child', 'card', 'card-project', 'hero-' ~ bundle|replace({"_": "-"}) ] %} {% set classes = [ 'is-child', 'card', 'card-project', 'hero-' ~ bundle|replace({"_": "-"}) ] %}
{# expected if statement would go here #} {# expected if statement would go here #}
@ -23,11 +21,13 @@
{% set title_paragraph_index = null %} {% set title_paragraph_index = null %}
{% set has_title_paragraph = false %} {% set has_title_paragraph = false %}
{% if content.field_body_paragraph %} {% if title.field_body_paragraph %}
{% for i, paragraph in content.field_body_paragraph if i|first != '#' %} Finally
{% if content.field_body_paragraph['#items'][i].entity.type.0.entity.id == 'title' %} {% 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 has_title_paragraph = true %}
{% set title_paragraph_index = i %} {% set title_paragraph_index = i %}
Wow
{{ paragraph }} {{ paragraph }}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
@ -49,5 +49,3 @@
{% endif %} {% endif %}
</div> </div>
{% endif %}{# content #}

View file

@ -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

View file

@ -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: '<a href="#" class="is-child card card-project is-cinnamon">
<div class="card-image" style="background-image:url(../assets/img/fpo-drtb-connamon.jpg)">
</div>
<div class="card-content">
<p class="title">DRTB Network</p>
<p class="subtitle">Community directory</p>
</div>
</a>'