You are here

file-link--card.html.twig in Open Social 8.7

Theme override for a link to a file for nodes.

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--card.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for a link to a file for nodes.
  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. <li class="card-file">
  19. <a class="card-file__link" href="{{ link.url.uri }}" title="{{ 'Open or download file'|t }}" target="_blank">
  20. <span class="card-file__title">{{ link.text|replace({'_': ' '}) }}</span>
  21. <span class="card-file__type">
  22. <img class="card-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 }}" />
  23. <span class="card-file__size">{{ file_size }}</span>
  24. </span>
  25. </a>
  26. </li>
  27. {% endspaceless %}