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

Open in your IDE?
  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.                                         } %}
  20.                                         {% if element.translated.config.displayMode.value == 'cover' or element.translated.config.displayMode.value == 'contain' %}
  21.                                             {% set attributes = attributes|merge({ 'data-object-fit': element.translated.config.displayMode.value }) %}
  22.                                         {% endif %}
  23.                                         {% sw_thumbnails 'cms-image-thumbnails' with {
  24.                                             media: element.data.media
  25.                                         } %}
  26.                                     {% endblock %}
  27.                                 </div>
  28.                             {% endif %}
  29.                         {% endblock %}
  30.                     {% endset %}
  31.                     {% if element.translated.config.url.value %}
  32.                         <a href="{{ element.translated.config.url.value }}"
  33.                            class="cms-image-link"
  34.                            {% if element.translated.config.newTab.value %}target="_blank" rel="noopener"{% endif %}>
  35.                             {{ imageElement }}
  36.                         </a>
  37.                     {% else %}
  38.                         {{ imageElement }}
  39.                     {% endif %}
  40.                 {% endblock %}
  41.             {% if config.verticalAlign.value %}
  42.                 </div>
  43.             {% endif %}
  44.         {% endblock %}
  45.     </div>
  46. {% endblock %}