projet.html.twig 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. {% extends 'partials/base.html.twig' %}
  2. {% set bodyclass = "projet" %}
  3. {% set images = page.media.images[2:] %}
  4. {% set images = images|merge(page.media.files) %}
  5. {% block content %}
  6. <section class="projet">
  7. <h1>{{page.title}}</h1>
  8. <h2>{{ page.header.subtitle}}</h2>
  9. {{ page.content }}
  10. <div id="images" class="">
  11. {{ dump(images) }}
  12. {# set temporary array to be able to look trough images with index #}
  13. {% set numberedKeys = {} %}
  14. {% for key,value in images %}
  15. {% set numberedKeys = numberedKeys|merge({(loop.index):(key)}) %}
  16. {% endfor %}
  17. {{dump(numberedKeys)}}
  18. {# display images #}
  19. {% set continue = false %}
  20. {% for image in images %}
  21. {% if not continue %}
  22. <div class="row">
  23. {% if image.meta.size == 1 %}
  24. <div class="block block-{{loop.index}} column large-12">
  25. {{ image.html }}
  26. </div>
  27. {% else %}
  28. {% set nextimage = images[numberedKeys[loop.index]] %}
  29. {{ dump(nextimage) }}
  30. {% if nextimage.meta.size != 1 %}
  31. {% set continue = true %}
  32. <div class="block block-{{loop.index}} column large-6">
  33. {{ image.resize(1000).html }}
  34. </div>
  35. <div class="block block-{{loop.index+1}} column large-6">
  36. {{ nextimage.resize(1000).html }}
  37. </div>
  38. {% else %}
  39. <div class="block block-{{loop.index}} column large-6">
  40. {{ image.resize(1000).html }}
  41. </div>
  42. <div class="block empty column large-6"></div>
  43. {% endif %}
  44. {% endif %}
  45. </div>
  46. {% else %}
  47. {% set continue = false %}
  48. {% endif %}
  49. {% endfor %}
  50. </div>
  51. </section>
  52. <nav class="categories">
  53. {% include 'partials/tagslist.html.twig' with {'base_url':"/categories/", 'taxonomy':'tag', 'display':'inline'} %}
  54. </nav>
  55. {% endblock %}