templates/bundles/SyliusShopBundle/Product/Show/_images.html.twig line 1

Open in your IDE?
  1. {% if product.imagesByType('main') is not empty %}
  2. {% set source_path = product.imagesByType('main').first.path %}
  3. {% set original_path = source_path|imagine_filter('sylius_shop_product_original') %}
  4. {% set path = source_path|imagine_filter(filter|default('sylius_shop_product_large_thumbnail')) %}
  5. {% elseif product.images.first %}
  6. {% set source_path = product.images.first.path %}
  7. {% set original_path = source_path|imagine_filter('sylius_shop_product_original') %}
  8. {% set path = source_path|imagine_filter(filter|default('sylius_shop_product_large_thumbnail')) %}
  9. {% else %}
  10. {% set original_path = '//placehold.it/400x300' %}
  11. {% set path = original_path %}
  12. {% endif %}
  13. <div data-product-image="{{ path }}" data-product-link="{{ original_path }}"></div>
  14. <a href="{{ original_path }}" class="ui fluid image" data-lightbox="sylius-product-image">
  15. <img src="{{ path }}" id="main-image" alt="{{ product.name }}" />
  16. </a>
  17. {% if product.images|length > 1 %}
  18. <div class="ui divider"></div>
  19. {{ sonata_block_render_event('sylius.shop.product.show.before_thumbnails', {'product': product}) }}
  20. <div class="ui small images">
  21. {% for image in product.images %}
  22. {% set path = image.path is not null ? image.path|imagine_filter('sylius_shop_product_small_thumbnail') : '//placehold.it/200x200' %}
  23. <div class="ui image">
  24. {% if product.isConfigurable() and product.variants|length > 0 %}
  25. {% include '@SyliusShop/Product/Show/_imageVariants.html.twig' %}
  26. {% endif %}
  27. <a href="{{ image.path|imagine_filter('sylius_shop_product_original') }}" data-lightbox="sylius-product-image">
  28. <img src="{{ path }}" data-large-thumbnail="{{ image.path|imagine_filter('sylius_shop_product_large_thumbnail') }}" alt="{{ product.name }}" />
  29. </a>
  30. </div>
  31. {% endfor %}
  32. </div>
  33. {% endif %}