Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{#
/**
* @file
* Default theme implementation of a responsive image.
*
* Available variables:
* - sources: The attributes of the <source> tags for this <picture> tag.
* - img_element: The controlling image, with the fallback image in srcset.
* - output_image_tag: Whether or not to output an <img> tag instead of a
* <picture> tag.
*
* @see template_preprocess()
* @see template_preprocess_responsive_image()
*
* @ingroup themeable
*/
#}
{% set responsive_image_base_class = responsive_image_base_class|default('image') %}
{% if output_image_tag %}
{% include "@atoms/06-images/_image.twig" with {
image_base_class: responsive_image_base_class,
image_modifiers: responsive_image_modifiers,
image_blockname: responsive_image_blockname,
img_srcset: img_srcset|default(img_element['#attributes'].srcset),
img_sizes: img_sizes|default(img_element['#attributes'].sizes),
img_src: img_src|default(img_element['#uri']),
img_alt: img_alt|default(img_element['#alt']),
img_title: img_title|default(img_element['#title']),
} %}
{% else %}
{% include "@atoms/06-images/_picture.twig" with {
picture_base_class: responsive_image_base_class,
picture_modifiers: responsive_image_modifiers,
picture_blockname: responsive_image_blockname,
img_srcset: img_srcset|default(img_element['#attributes'].srcset),
img_sizes: img_sizes|default(img_element['#attributes'].sizes),
img_src: img_src|default(img_element['#uri']),
img_alt: img_alt|default(img_element['#alt']),
img_title: img_title|default(img_element['#title']),
} %}
{% endif %}