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
* 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 <div>.
* It extracts the title paragraph, if any, from a body paragraphs listing.
*
* @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 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 }}
<div class="column is-one-third">
{{ paragraph }}
</div>
{% endif %}
{% endfor %}
{% endif %}
{% if not has_title_paragraph %}
<a{{ attributes.addClass(classes) }}>
{# 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>
<!-- This content not shown because it does not have a title paragraph. -->
{% endif %}
</div>