file-link.html.twig 805 B

1234567891011121314151617181920212223242526272829303132
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for a link to a file.
  5. *
  6. * Available variables:
  7. * - attributes: The HTML attributes for the containing element.
  8. * - link: A link to the file.
  9. * - file_size: The size of the file.
  10. * - file: L'objet fichier (si fourni).
  11. *
  12. * @see template_preprocess_file_link()
  13. *
  14. * @ingroup themeable
  15. */
  16. #}
  17. <span{{ attributes }}>
  18. {# Si c’est une image PNG ou JPG → ajouter la classe popup-link #}
  19. {% if file.mime == 'image/png' or file.mime == 'image/jpeg' %}
  20. {{ link|replace({'<a ': '<a class="popup-link" '})|raw }}
  21. {% else %}
  22. {{ link }}
  23. {% endif %}
  24. </span>
  25. {% if file_size %}
  26. <span>({{ file_size }})</span>
  27. {% endif %}
  28. <div id="popup-overlay">
  29. <span class="popup-close">&times;</span>
  30. <img id="popup-image" src="" alt="Aperçu"/>
  31. </div>