app/template/default/Block/category_nav_pc.twig line 11

Open in your IDE?
  1. {#
  2. This file is part of EC-CUBE
  3. Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  4. http://www.ec-cube.co.jp/
  5. For the full copyright and license information, please view the LICENSE
  6. file that was distributed with this source code.
  7. #}
  8. {% set Categories = repository('Eccube\\Entity\\Category').getList() %}
  9. {% if app.request.get('_route') == 'product_list' or app.request.get('_route') == 'subsc_items' %}
  10. {# 商品一覧ページの場合(ページ内遷移) #}
  11.     {% macro tree(Category) %}
  12.         {% from _self import tree %}
  13.         {% if app.request.get('_route') == 'product_list'%}
  14.             <a href="#cat_{{ Category.id }}"><i class="fas fa-chevron-down"></i>{{ ('front.block.category.list_text.id.' ~ Category.id)|trans }}</a>
  15.         {% else %}
  16.             <a href="#cat_{{ Category.id }}"><i class="fas fa-chevron-down"></i>{{ ('front.block.category.list_text.id.' ~ Category.id)|trans }}</a>
  17.         {% endif %}
  18.         {% if Category.children|length > 0 %}
  19.             <ul>
  20.                 {% for ChildCategory in Category.children %}
  21.                     <li>
  22.                         {{ tree(ChildCategory) }}
  23.                     </li>
  24.                 {% endfor %}
  25.             </ul>
  26.         {% endif %}
  27.     {% endmacro %}
  28.     {% from _self import tree %}
  29.     <div class="ec-categoryNaviRole">
  30.         <div class="ec-itemNav">
  31.             <ul class="ec-itemNav__nav">
  32.                 {% for Category in Categories %}
  33.                     <li>
  34.                         {{ tree(Category) }}
  35.                     </li>
  36.                 {% endfor %}
  37.             </ul>
  38.         </div>
  39.     </div>
  40. {% endif %}