Rework proof of concept

leave in some remaks on insanity:

{{ content }} doesn't print out any paragraphs; only {{ content.content}} does that.
This commit is contained in:
benjamin melançon 2018-10-24 18:38:15 -04:00
parent 0d59e58618
commit 7084b3ed7c

View file

@ -22,16 +22,15 @@
{# expected if statement would start here #} {# expected if statement would start here #}
{% set classes = classes|merge(['is-dark']) %} {% set classes = classes|merge(['is-dark']) %}
{% set title_paragraph_index = 'silly' %} {% set title_paragraph_index = null %}
{% set tpi = null %}
{% set has_title_paragraph = false %} {% set has_title_paragraph = false %}
{% if content.field_body_paragraph %} {% if content.field_body_paragraph %}
{% for i, paragraph in content.field_body_paragraph['#items'] %} {% for i, paragraph in content.field_body_paragraph if i|first != '#' %}
{% if paragraph.entity.type.0.entity.id == 'title' %} {% if content.field_body_paragraph['#items'][i].entity.type.0.entity.id == 'title' %}
HOLY MOLY THIS HAS TAKEN A WHILE
{% set has_title_paragraph = true %} {% set has_title_paragraph = true %}
{{ content.field_body_paragraph[i] }}
{% set title_paragraph_index = i %} {% set title_paragraph_index = i %}
{% set tpi = i %} {{ paragraph }}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
@ -47,21 +46,21 @@
</section> </section>
{% endif %} {% endif %}
{{ content.field_simple_multivalue[0] }}
{% for i in 1..2 %}
{{ content.field_simple_multivalue[i] }}
{% endfor %}
AND HERE COMES THE REST<br />
No number huh? {{ title_paragraph_index }}
<br />Ehh? {{ tpi }}
<br />Gah. {{ has_title_paragraph }}
<section{{ attributes.addClass(classes) }}> <section{{ attributes.addClass(classes) }}>
{% for i, paragraph in content.field_body_paragraph if i|first != '#' %} {% for i, paragraph in content.field_body_paragraph if i|first != '#' %}
NOO NUMBERSSS {{ i }} {% if i is not same as(title_paragraph_index) %}
{{ paragraph }} {{ paragraph }}
{% endif %}
{% endfor %} {% endfor %}
{{ content|without('content', 'field_body_paragraph') }} {{ content|without('content', 'field_body_paragraph') }}
</section> </section>
SANITY CHECK
{{ content }}
NOPE EVERYTHING IS INSANE OH WELL
{{ content.content }}
{% endif %} {% endif %}