themes/BootstrapTheme/templates/bundles/SyliusShopBundle/Taxon/_indexMenu.html.twig line 1

Open in your IDE?
  1. {% import "@SyliusShop/Common/Macro/icons.html.twig" as icons %}
  2. {% macro item(taxon, isChild) %}
  3.     {% import _self as macros %}
  4.     {% if taxon.children|length > 0 %}
  5.         <div class="{% if isChild <= 2 %}col-sm-6 {% else %} col-md-4 col-sm-6 {% endif %} col-12 mb-md-5 mb-3 px-md-4 px-3" {{ sylius_test_html_attribute('menu-item') }}>
  6.             <div class="h-100 category-item-index flex-column d-flex">
  7.                 <div class="category-item-img mx-sm-0 mx-n3">
  8.                     {% if taxon.images.first %}
  9.                             {% set path = taxon.images.first.path|imagine_filter(filter|default('app_shop_taxon_show_index')) %}
  10.                     {% else %}
  11.                         {% set path = asset('images/imgcateg_i1.jpg') %}
  12.                     {% endif %}
  13.                         <a href="{{ path('sylius_shop_product_index', {'slug': taxon.slug, '_locale': taxon.translation.locale}) }}"><img src="{{ path }}" alt="{{ taxon.name }}" class="w-100" /></a>
  14.                 </div>
  15.                 <h3 class="category-item-lib"><a href="{{ path('sylius_shop_product_index', {'slug': taxon.slug, '_locale': taxon.translation.locale}) }}">{{ taxon.name }}</a></h3>
  16.                 <div class="flex-grow-l text-grey fontsize-normal">
  17.                     <p>{{ taxon.description|raw }}</p>
  18.                 </div>
  19.                 <div class="">
  20.                     <ul class="row mx-n2 list-unstyled">
  21.                         {% for childTaxon in taxon.children %}
  22.                         <li class="{% if isChild <= 2 %}col-6 {% else %}col-12{% endif %} px-2 "><a href="{{ path('sylius_shop_product_index', {'slug': childTaxon.slug, '_locale': childTaxon.translation.locale}) }}">> <span>{{ childTaxon.name }}</span></a></li>
  23.                         {% endfor %}
  24.                     </ul>
  25.                 </div>
  26.             </div>
  27.         </div>
  28.     {% else %}
  29.          <div class="{% if isChild <= 2 %}col-sm-6 {% else %} col-md-4 col-sm-6 {% endif %} col-12 mb-md-5 mb-3 px-md-4 px-3">
  30.             <div class="h-100 category-item-index flex-column d-flex">
  31.                 <div class="category-item-img mx-sm-0 mx-n3">
  32.                     {% if taxon.images.first %}
  33.                             {% set path = taxon.images.first.path|imagine_filter(filter|default('app_shop_taxon_show_index')) %}
  34.                     {% else %}
  35.                         {% set path = asset('images/imgcateg_i1.jpg') %}
  36.                     {% endif %}
  37.                         <a href="{{ path('sylius_shop_product_index', {'slug': taxon.slug, '_locale': taxon.translation.locale}) }}"><img src="{{ path }}" alt="{{ taxon.name }}" class="w-100" /></a>
  38.                 </div>
  39.                 <h3 class="category-item-lib"><a href="{{ path('sylius_shop_product_index', {'slug': taxon.slug, '_locale': taxon.translation.locale}) }}">{{ taxon.name }}</a></h3>
  40.                 <div class="flex-grow-l text-grey fontsize-normal">
  41.                     <p>{{ taxon.description|raw }}</p>
  42.                 </div>
  43.                 <div class="">
  44.                     <ul class="row mx-n2 list-unstyled">
  45.                         {% for childTaxon in taxon.children %}
  46.                         <li class="{% if isChild <= 2 %}col-6 {% else %}col-12{% endif %} px-2 "><a href="{{ path('sylius_shop_product_index', {'slug': childTaxon.slug, '_locale': childTaxon.translation.locale}) }}">> <span>{{ childTaxon.name }}</span></a></li>
  47.                         {% endfor %}
  48.                     </ul>
  49.                 </div>
  50.             </div>
  51.         </div>
  52.     {% endif %}
  53. {% endmacro %}
  54. {% import _self as macros %}
  55. {% if taxons|length > 0 %}
  56.     <section class="bloc-category-index px-3 py-md-5 pt-4 pb-2 mt-2 mt-md-4">
  57.         <div class="max-container-2 px-0">
  58.             <h2 class="title-medium color-blue-s text-left">{{'app.homepage.our_categories'|trans}}</h2>
  59.             <div class="row mx-xl-n4 mx-n3 pt-2 pt-md-3">
  60.                 {% for taxon in taxons %}
  61.                     {{ macros.item(taxon, loop.index) }}
  62.                 {% endfor %}
  63.             </div>
  64.         </div>
  65.     </div>
  66. {% endif %}