Version 1
[yaffs-website] / web / themes / contrib / bootstrap / templates / file / file-link.html.twig
1 {#
2 /**
3  * @file
4  * Theme override 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  * - icon: An icon.
10  * - icon_only: Flag to display only the icon and not the label.
11  * - icon_position: Where an icon should be displayed.
12  *
13  * @ingroup templates
14  *
15  * @see \Drupal\bootstrap\Plugin\Preprocess\FileLink::preprocessVariables
16  */
17 #}
18 {% spaceless %}
19   {%
20     set classes = [
21       icon_only ? 'icon-only',
22       not icon_only ? 'icon-' ~ icon_position|clean_class
23     ]
24   %}
25   <span{{ attributes.addClass(classes) }}>
26     {% if icon_only %}
27       <span class="file-icon">{{ icon }}</span>
28       <span class="sr-only">
29         <span class="file-link">{{ link }}</span>
30         <span class="file-size">{{ file_size }}</span>
31       </span>
32     {% else %}
33       {% if icon_position == 'after' %}
34         <span class="file-link">{{ link }}</span><span class="file-size">{{ file_size }}</span><span class="file-icon">{{ icon }}</span>
35       {% else %}
36         <span class="file-icon">{{ icon }}</span><span class="file-link">{{ link }}</span><span class="file-size">{{ file_size }}</span>
37       {% endif %}
38     {% endif %}
39   </span>
40 {% endspaceless %}