You are here

file-link.html.twig in Open Social 8.8

Theme override for a link to a file for forms (default).

Available variables:

  • attributes: The HTML attributes for the containing element.
  • link: A link to the file.
  • node_icon: An icon.

See also

\Drupal\bootstrap\Plugin\Preprocess\FileLink::preprocessVariables

File

themes/socialbase/templates/file/file-link.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for a link to a file for forms (default).
  5. *
  6. * Available variables:
  7. * - attributes: The HTML attributes for the containing element.
  8. * - link: A link to the file.
  9. * - node_icon: An icon.
  10. *
  11. * @ingroup templates
  12. *
  13. * @see \Drupal\bootstrap\Plugin\Preprocess\FileLink::preprocessVariables
  14. */
  15. #}
  16. {{ attach_library('socialbase/file') }}
  17. {% spaceless %}
  18. <span{{ attributes }}>
  19. {% if icon_only %}
  20. <span class="file-icon"><img class="node-file__icon" src="/{{ path_to_socialbase }}/assets/images/mime-icons/icon_1_{{ node_icon }}_x16.png" srcset="/{{ path_to_socialbase }}/assets/images/mime-icons/icon_1_{{ node_icon }}_x32.png 2x" alt="{{ node_icon }}" /></span>
  21. <span class="sr-only">
  22. <span class="file-link">{{ link }}</span>
  23. <span class="file-size">{{ file_size }}</span>
  24. </span>
  25. {% else %}
  26. <span class="file-icon"><img class="node-file__icon" src="/{{ path_to_socialbase }}/assets/images/mime-icons/icon_1_{{ node_icon }}_x16.png" srcset="/{{ path_to_socialbase }}/assets/images/mime-icons/icon_1_{{ node_icon }}_x32.png 2x" alt="{{ node_icon }}" /></span><span class="file-link">{{ link }}</span><span class="file-size">{{ file_size }}</span>
  27. {% endif %}
  28. </span>
  29. {% endspaceless %}