Skip to content

Instantly share code, notes, and snippets.

@rbayliss
Last active October 13, 2017 22:13
Show Gist options
  • Save rbayliss/0f8414a6ac15f38ac4165eac513300d7 to your computer and use it in GitHub Desktop.
Save rbayliss/0f8414a6ac15f38ac4165eac513300d7 to your computer and use it in GitHub Desktop.
{#
This is a glue template. It maps Drupal data to a simpler structure.
In this case, it converts the items render array into an array
of rendered images, then passes that into the image-grid component.
It also handles outputting the wrapper with the attributes Drupal
requires.
#}
{% set images = [] %}
{% for item in items %}
{% set images = images|merge([item|render]) %}
{% endfor %}
<div{{attributes}}>
{% include 'components/image-grid.html.twig' with {
images: images
} only %}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment