vendor/shopware/storefront/Resources/views/storefront/element/cms-element-image.html.twig line 1

  1. {% block element_image %}
  2.     {% set config = element.fieldConfig.elements %}
  3.     <div class="cms-element-{{ element.type }}{% if config.verticalAlign.value %} has-vertical-alignment{% endif %}">
  4.         {% block element_product_slider_alignment %}
  5.             {% if config.verticalAlign.value %}
  6.                 <div class="cms-element-alignment{% if config.verticalAlign.value == "center" %} align-self-center{% elseif config.verticalAlign.value == "flex-end" %} align-self-end{% else %} align-self-start{% endif %}">
  7.             {% endif %}
  8.                 {% block element_image_inner %}
  9.                     {% set imageElement %}
  10.                         {% block element_image_container %}
  11.                             {% if element.data.media.url %}
  12.                                 <div class="cms-image-container is-{{ element.translated.config.displayMode.value }}"
  13.                                     {% if element.translated.config.minHeight.value and element.translated.config.displayMode.value == "cover" %} style="min-height: {{ element.translated.config.minHeight.value }};"{% endif %}>
  14.                                     {% block element_image_media %}
  15.                                         {% set attributes = {
  16.                                             'class': 'cms-image',
  17.                                             'alt': (element.data.media.translated.alt ?: ''),
  18.                                             'title': (element.data.media.translated.title ?: ''),
  19.                                             'loading': 'lazy'
  20.                                         } %}
  21.                                         {% if element.translated.config.displayMode.value == 'cover' or element.translated.config.displayMode.value == 'contain' %}
  22.                                             {% set attributes = attributes|merge({ 'data-object-fit': element.translated.config.displayMode.value }) %}
  23.                                         {% endif %}
  24.                                         {% sw_thumbnails 'cms-image-thumbnails' with {
  25.                                             media: element.data.media
  26.                                         } %}
  27.                                     {% endblock %}
  28.                                 </div>
  29.                             {% endif %}
  30.                         {% endblock %}
  31.                     {% endset %}
  32.                     {% if element.translated.config.url.value %}
  33.                         <a href="{{ element.translated.config.url.value }}"
  34.                            class="cms-image-link"
  35.                            {% if element.translated.config.newTab.value %}target="_blank" rel="noopener"{% endif %}>
  36.                             {{ imageElement }}
  37.                         </a>
  38.                     {% else %}
  39.                         {{ imageElement }}
  40.                     {% endif %}
  41.                 {% endblock %}
  42.             {% if config.verticalAlign.value %}
  43.                 </div>
  44.             {% endif %}
  45.         {% endblock %}
  46.     </div>
  47. {% endblock %}