templates/partials/supporterBlockVariance.html.twig line 1

Open in your IDE?
  1. {# supporterBlockVariance.html.twig #}
  2. {% set supporters = content.supporters.blocks|default([]) %}
  3. {% for supporter in supporters %}
  4. <img src="{{ sulu_get_media_url(supporter.image) }}" alt="{{ supporter.name|default('Media') }}">
  5. {% else %}
  6. <p>Keine Bilder vorhanden</p>
  7. {% endfor %}
  8. {% macro mediaId(image) %}
  9. {% if image is defined and image.id is defined %}
  10. {{- image.id -}}
  11. {% else %}
  12. {{- '' -}}
  13. {% endif %}
  14. {% endmacro %}
  15. {% macro mediaUrl(image, format='thumbnail') %}
  16. {% if image is defined and image.id is defined %}
  17. {{- sulu_get_media_url(image.id, format)|default('') -}}
  18. {% else %}
  19. {{- '' -}}
  20. {% endif %}
  21. {% endmacro %}
  22. {% macro mediaName(image) %}
  23. {% if image is defined and image.name is defined %}
  24. {{- image.name -}}
  25. {% else %}
  26. {{- 'Media' -}}
  27. {% endif %}
  28. {% endmacro %}
  29. {% import _self as m %}
  30. <div class="supporter-block">
  31. {% for supporter in supporters %}
  32. {% set url = m.mediaUrl(supporter.image, 'thumbnail') %}
  33. <div class="supporter">
  34. {% if url %}
  35. <img src="{{ url }}" alt="{{ m.mediaName(supporter.image) }}">
  36. {% else %}
  37. <span class="no-image">kein Bild verfügbar</span>
  38. {% endif %}
  39. <span>{{ supporter.name }}</span>
  40. </div>
  41. {% endfor %}
  42. </div>