Print only the title paragraph

This commit is contained in:
benjamin melançon 2018-11-12 22:49:49 -05:00
parent d555ba5b57
commit b8aea06ffd

View file

@ -1,51 +1,30 @@
{# {#
/** /**
* @file * @file
* Default theme implementation to display a one-column layout. * Default theme implementation to display a pargraph section.
* *
* Available variables: * It extracts the title paragraph, if any, from a body paragraphs listing.
* - content: The content for this layout.
* - attributes: HTML attributes for the layout <div>.
* *
* @ingroup themeable * @ingroup themeable
*/ */
#} #}
{{ dump(_context|keys) }}
<div class="column is-one-third">
{% 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 title_paragraph_index = null %}
{% set has_title_paragraph = false %} {% set has_title_paragraph = false %}
{% if title.field_body_paragraph %} {% if paragraphs.field_body_paragraph %}
Finally {% for i, paragraph in paragraphs.field_body_paragraph if i|first != '#' %}
{% for i, paragraph in title.field_body_paragraph if i|first != '#' %} {% if paragraphs.field_body_paragraph['#items'][i].entity.type.0.entity.id == 'title' %}
{% 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 <div class="column is-one-third">
{{ paragraph }} {{ paragraph }}
</div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if not has_title_paragraph %} {% if not has_title_paragraph %}
<a{{ attributes.addClass(classes) }}> <!-- This content not shown because it does not have a title paragraph. -->
{# Header hero region #}
<div class="card-content">
<div class="title">
{{ content.title }}
buuuut you do have a title paragraph
</div>
<p class="subtitle">
{{ subtitle }}
</p>
</div>
</section>
{% endif %} {% endif %}
</div>