themes/BootstrapTheme/templates/bundles/SyliusShopBundle/Product/_mainImage.html.twig line 1

Open in your IDE?
  1. {% if product.imagesByType('main') is not empty %}
  2.     {% set path = product.imagesByType('main').first.path|imagine_filter(filter|default('sylius_shop_product_small_thumbnail')) %}
  3.     {% set alt = product.imagesByType('main').first.alt %}
  4.     {% if app_file_exists((path ~ ".webp")|replace({"resolve/": ""})) %}
  5.     <picture>
  6.         <source srcset="{{ (path ~ ".webp")|replace({'resolve/':''}) }}" {% if class is defined %}class="{{ class }}"{% endif %} {{ sylius_test_html_attribute('main-image') }} />
  7.         <img src="{{ (path) }}" alt="{{ alt }}" {% if class is defined %}class="{{ class }}"{% endif %} {{ sylius_test_html_attribute('main-image') }} />
  8.         </picture>
  9.     {% else %}
  10.         <img src="{{ (path) }}" alt="{{ alt }}"class="w-100"{{ sylius_test_html_attribute('main-image') }} />
  11.     {% endif %}
  12. {% elseif product.images.first %}
  13.     {% set path = product.images.first.path|imagine_filter(filter|default('sylius_shop_product_small_thumbnail')) %}
  14.     {% set alt = product.images.first.alt %}
  15.     {% if app_file_exists((path ~ ".webp")|replace({"resolve/": ""})) %}
  16.         <picture>
  17.             <source srcset="{{ (path ~ ".webp")|replace({'resolve/':''}) }}" {% if class is defined %}class="{{ class }}"{% endif %} {{ sylius_test_html_attribute('main-image') }} />
  18.             <img src="{{ (path) }}" alt="{{ alt }}" {% if class is defined %}class="{{ class }}"{% endif %} {{ sylius_test_html_attribute('main-image') }} />
  19.         </picture>
  20.     {% else %}
  21.         <img src="{{ (path) }}" alt="{{ alt }}"class="w-100"{{ sylius_test_html_attribute('main-image') }} />
  22.     {% endif %}
  23. {% else %}
  24.    
  25.     {% set alt = product.name %}
  26. {% endif %}
  27. {% if alt == "" or alt is null %}
  28.     {% set alt = product.name %}
  29. {% endif %}