templates/backOffice/util/_pagination.html.twig line 1

Open in your IDE?
  1. {% if pageCount > 1 %}
  2.     <nav>
  3.         <ul class="pagination justify-content-end my-4">
  4.             {% if current > 1 %}
  5.                 {% set previousPage = current - 1 %}
  6.                 <li class="page-item">
  7.                     <a class="page-link"
  8.                        href="{{ path(route, query | merge({(pageParameter): previousPage})) }}">
  9.                         <span>&laquo;</span>
  10.                     </a>
  11.                 </li>
  12.             {% else %}
  13.                 <li class="page-item disabled">
  14.                     <span class="page-link">
  15.                         <span>&laquo;</span>
  16.                     </span>
  17.                 </li>
  18.             {% endif %}
  19.             {% if startPage > 1 %}
  20.                 <li class="page-item">
  21.                     <a class="page-link" href="{{ path(route, query | merge({(pageParameter): 1})) }}">1</a>
  22.                 </li>
  23.                 {% if startPage == 3 %}
  24.                     <li class="page-item">
  25.                         <a class="page-link" href="{{ path(route, query | merge({(pageParameter): 2})) }}">2</a>
  26.                     </li>
  27.                 {% elseif startPage != 2 %}
  28.                     <li class="page-item disabled">
  29.                         <span class="page-link">&hellip;</span>
  30.                     </li>
  31.                 {% endif %}
  32.             {% endif %}
  33.             {% for page in pagesInRange %}
  34.                 {% if page is not null %}
  35.                     {% if page != current %}
  36.                         <li class="page-item">
  37.                             <a class="page-link"
  38.                                href="{{ path(route, query|merge({(pageParameter): page})) }}">{{ page }}</a>
  39.                         </li>
  40.                     {% else %}
  41.                         <li class="page-item active">
  42.                             <span class="page-link">{{ page }}</span>
  43.                         </li>
  44.                     {% endif %}
  45.                 {% endif %}
  46.             {% endfor %}
  47.             {% if pageCount > endPage %}
  48.                 {% if pageCount > (endPage + 1) %}
  49.                     {% if pageCount > (endPage + 2) %}
  50.                         <li class="page-item disabled">
  51.                             <span class="page-link">&hellip;</span>
  52.                         </li>
  53.                     {% else %}
  54.                         <li class="page-item">
  55.                             <a class="page-link"
  56.                                href="{{ path(route, query|merge({(pageParameter): (pageCount - 1)})) }}">{{ pageCount -1 }}</a>
  57.                         </li>
  58.                     {% endif %}
  59.                 {% endif %}
  60.                 <li class="page-item">
  61.                     <a class="page-link"
  62.                        href="{{ path(route, query|merge({(pageParameter): pageCount})) }}">{{ pageCount }}</a>
  63.                 </li>
  64.             {% endif %}
  65.             {% if current < pageCount %}
  66.                 {% set nextPage = current + 1 %}
  67.                 <li class="page-item">
  68.                     <a class="page-link" href="{{ path(route, query | merge({(pageParameter): nextPage})) }}">
  69.                         <span>&raquo;</span>
  70.                     </a>
  71.                 </li>
  72.             {% else %}
  73.                 <li class="page-item">
  74.                     <span class="page-link">
  75.                         <span>&raquo;</span>
  76.                     </span>
  77.                 </li>
  78.             {% endif %}
  79.         </ul>
  80.     </nav>
  81. {% endif %}