Skip to content

Instantly share code, notes, and snippets.

@mortendk
Created September 18, 2013 15:06
Show Gist options
  • Save mortendk/6610523 to your computer and use it in GitHub Desktop.
Save mortendk/6610523 to your computer and use it in GitHub Desktop.
field image twig
{# title wtf is this called label btw #}
{% if not label_hidden %}
<h3 {{ title_attributes }}>{{ label }}:&nbsp;</h3>
{% endif %}
{% for delta, item in items %}
{% if loop.length > 1 %} {# no wrappers if theres only 1 item#}
<section class="images" {{ content_attributes }}> {# wanna do a print all attributes but no class #}
{% endif %}
<figure class="image {{ cycle(["even", "odd"], delta) }}"{{ item_attributes[delta] }}>
{{ item }}
<figcaption>
<pre>{{ dump(item.alt) }}</pre>
</figcaption>
</figure>
{% if loop.length > 1 %}
</section>
{% endif %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment