custom/plugins/IeaMedical/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 totalEntities = total ? total : entities.total %}
  4.     {% set totalPages = (totalEntities / criteria.limit)|round(0, 'ceil') %}
  5.     {% set paginationSuffix = '' %}
  6.     {# @deprecated tag:v6.5.0 - pagination template will append `paginationSuffix` for input and label ids to avoid duplicate ids. #}
  7.     {% if feature('v6.5.0.0') and paginationLocation %}
  8.         {% set paginationSuffix = '-' ~ paginationLocation %}
  9.     {% endif %}
  10.     {% if totalPages > 1 %}
  11.         <nav aria-label="pagination" class="pagination-nav">
  12.             {% block component_pagination %}
  13.                 <ul class="pagination">
  14.                     {% block component_pagination_loop %}
  15.                         {% set start = currentPage - 2 %}
  16.                         {% if start <= 0 %}
  17.                             {% set start = currentPage - 1 %}
  18.                             {% if start <= 0 %}
  19.                                 {% set start = currentPage %}
  20.                             {% endif %}
  21.                         {% endif %}
  22.                         {% set end = start + 4 %}
  23.                         {% if end > totalPages %}
  24.                             {% set end = totalPages %}
  25.                         {% endif %}
  26.                         {% for page in start..end %}
  27.                             {% set isActive = (currentPage == page) %}
  28.                             {% block component_pagination_item %}
  29.                                 <li class="page-item{% if isActive %} active{% endif %}">
  30.                                     {% block component_pagination_item_input %}
  31.                                         <input type="radio"
  32.                                                name="p"
  33.                                                id="p{{ page }}{{ paginationSuffix }}"
  34.                                                value="{{ page }}"
  35.                                                class="d-none"
  36.                                                title="pagination"
  37.                                                {% if isActive %}checked="checked"{% endif %}>
  38.                                     {% endblock %}
  39.                                     {% block component_pagination_item_label %}
  40.                                         <label class="page-link"
  41.                                                for="p{{ page }}{{ paginationSuffix }}">
  42.                                             {% block component_pagination_item_link %}
  43.                                                 {% block component_pagination_item_text %}
  44.                                                     {{ page }}
  45.                                                 {% endblock %}
  46.                                             {% endblock %}
  47.                                         </label>
  48.                                     {% endblock %}
  49.                                 </li>
  50.                             {% endblock %}
  51.                         {% endfor %}
  52.                     {% endblock %}
  53.                     {% block component_pagination_next %}
  54.                         <li class="page-item page-next{% if currentPage == totalPages %} disabled{% endif %}">
  55.                             {% block component_pagination_next_input %}
  56.                                 <input type="radio"
  57.                                        {% if currentPage == totalPages %}disabled="disabled"{% endif %}
  58.                                        name="p"
  59.                                        id="p-next{{ paginationSuffix }}"
  60.                                        value="{{ currentPage + 1 }}"
  61.                                        class="d-none"
  62.                                        title="pagination">
  63.                             {% endblock %}
  64.                             {% block component_pagination_next_label %}
  65.                                 <label class="page-link" for="p-next{{ paginationSuffix }}">
  66.                                     {% block component_pagination_next_link %}
  67.                                         {% block component_pagination_next_icon %}
  68.                                             {{ 'Next' }}
  69.                                         {% endblock %}
  70.                                     {% endblock %}
  71.                                 </label>
  72.                             {% endblock %}
  73.                         </li>
  74.                     {% endblock %}
  75.                 </ul>
  76.             {% endblock %}
  77.         </nav>
  78.     {% endif %}
  79. {% endblock %}