custom/plugins/KayloBasicTheme/src/Resources/views/storefront/component/pagination.html.twig line 1

Open in your IDE?
  1. {% block component_pagination_nav %}
  2.     {% set currentPage = ((criteria.offset + 1) / criteria.limit )|round(0, 'ceil') %}
  3.     {% set totalPages = (entities.total / criteria.limit)|round(0, 'ceil') %}
  4.     {% if totalPages > 1 %}
  5.         <nav aria-label="pagination" class="pagination-nav">
  6.             {% block component_pagination %}
  7.             <ul class="pagination">
  8.                 {% block component_pagination_first %}
  9.                     <li class="page-item page-first{% if currentPage == 1 %} disabled{% endif %}">
  10.                         {% block component_pagination_first_input %}
  11.                             <input type="radio"
  12.                                    {% if currentPage == 1 %}disabled="disabled"{% endif %}
  13.                                    name="p"
  14.                                    id="p-first"
  15.                                    value="1"
  16.                                    class="d-none"
  17.                                    title="pagination">
  18.                         {% endblock %}
  19.                         {% block component_pagination_first_label %}
  20.                             <label class="page-link" for="p-first">
  21.                                 {% block component_pagination_first_link %}
  22.                                     {% sw_icon 'arrow-medium-double-left' style { 'size': 'fluid', 'pack': 'solid'} %}
  23.                                 {% endblock %}
  24.                             </label>
  25.                         {% endblock %}
  26.                     </li>
  27.                 {% endblock %}
  28.                 {% block component_pagination_prev %}
  29.                     <li class="page-item page-prev{% if currentPage == 1 %} disabled{% endif %}">
  30.                         {% block component_pagination_prev_input %}
  31.                             <input type="radio"
  32.                                    {% if currentPage == 1 %}disabled="disabled"{% endif %}
  33.                                    name="p"
  34.                                    id="p-prev"
  35.                                    value="{{ currentPage - 1 }}"
  36.                                    class="d-none"
  37.                                    title="pagination">
  38.                         {% endblock %}
  39.                         {% block component_pagination_prev_label %}
  40.                             <label class="page-link" for="p-prev">
  41.                                 {% block component_pagination_prev_link %}
  42.                                     {% block component_pagination_prev_icon %}
  43.                                         {% sw_icon 'arrow-medium-left' style {'size': 'fluid', 'pack': 'solid'} %}
  44.                                     {% endblock %}
  45.                                 {% endblock %}
  46.                             </label>
  47.                         {% endblock %}
  48.                     </li>
  49.                 {% endblock %}
  50.                 {% block component_pagination_loop %}
  51.                     {% set start = currentPage - 2 %}
  52.                     {% if start <= 0 %}
  53.                         {% set start = currentPage - 1 %}
  54.                         {% if start <= 0 %}
  55.                             {% set start = currentPage %}
  56.                         {% endif %}
  57.                     {% endif %}
  58.                     {% set end = start + 4 %}
  59.                     {% if end > totalPages %}
  60.                         {% set end = totalPages %}
  61.                     {% endif %}
  62.                     {% for page in start..end %}
  63.                         {% set isActive = (currentPage == page) %}
  64.                         {% block component_pagination_item %}
  65.                             <li class="page-item{% if isActive %} active{% endif %}">
  66.                                 {% block component_pagination_item_input %}
  67.                                     <input type="radio"
  68.                                            name="p"
  69.                                            id="p{{ page }}"
  70.                                            value="{{ page }}"
  71.                                            class="d-none"
  72.                                            title="pagination"
  73.                                            {% if isActive %}checked="checked"{% endif %}>
  74.                                 {% endblock %}
  75.                                 {% block component_pagination_item_label %}
  76.                                     <label class="page-link"
  77.                                            for="p{{ page }}">
  78.                                         {% block component_pagination_item_link %}
  79.                                             {% block component_pagination_item_text %}
  80.                                                 {{ page }}
  81.                                             {% endblock %}
  82.                                         {% endblock %}
  83.                                     </label>
  84.                                 {% endblock %}
  85.                             </li>
  86.                         {% endblock %}
  87.                     {% endfor %}
  88.                 {% endblock %}
  89.                 {% block component_pagination_next %}
  90.                     <li class="page-item page-next{% if currentPage == totalPages %} disabled{% endif %}">
  91.                         {% block component_pagination_next_input %}
  92.                             <input type="radio"
  93.                                    {% if currentPage == totalPages %}disabled="disabled"{% endif %}
  94.                                    name="p"
  95.                                    id="p-next"
  96.                                    value="{{ currentPage + 1 }}"
  97.                                    class="d-none"
  98.                                    title="pagination">
  99.                         {% endblock %}
  100.                         {% block component_pagination_next_label %}
  101.                             <label class="page-link" for="p-next">
  102.                                 {% block component_pagination_next_link %}
  103.                                     {% block component_pagination_next_icon %}
  104.                                         {% sw_icon 'arrow-medium-right' style { 'size': 'fluid', 'pack': 'solid'} %}
  105.                                     {% endblock %}
  106.                                 {% endblock %}
  107.                             </label>
  108.                         {% endblock %}
  109.                     </li>
  110.                 {% endblock %}
  111.                 {% block component_pagination_last %}
  112.                     <li class="page-item page-last{% if currentPage == totalPages %} disabled{% endif %}">
  113.                         {% block component_pagination_last_input %}
  114.                             <input type="radio"
  115.                                    {% if currentPage == totalPages %}disabled="disabled"{% endif %}
  116.                                    name="p"
  117.                                    id="p-last"
  118.                                    value="{{ totalPages }}"
  119.                                    class="d-none"
  120.                                    title="pagination">
  121.                         {% endblock %}
  122.                         {% block component_pagination_last_label %}
  123.                             <label class="page-link" for="p-last">
  124.                                 {% block component_pagination_last_link %}
  125.                                     {% block component_pagination_last_icon %}
  126.                                         {% sw_icon 'arrow-medium-double-right' style {
  127.                                             'size': 'fluid',
  128.                                             'pack': 'solid'
  129.                                         } %}
  130.                                     {% endblock %}
  131.                                 {% endblock %}
  132.                             </label>
  133.                         {% endblock %}
  134.                     </li>
  135.                 {% endblock %}
  136.             </ul>
  137.         {% endblock %}
  138.         </nav>
  139.     {% endif %}
  140. {% endblock %}