Created
September 18, 2013 15:06
-
-
Save mortendk/6610523 to your computer and use it in GitHub Desktop.
field image twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# title wtf is this called label btw #} | |
{% if not label_hidden %} | |
<h3 {{ title_attributes }}>{{ label }}: </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
Related issues:
http://drupal.stackexchange.com/questions/97876/printing-field-item-attributes-with-twig-drupal-8
https://drupal.org/node/2160611