templates/pagination.html.twig line 1

Open in your IDE?
  1. {#
  2. /**
  3.  * @file
  4.  * Twitter Bootstrap v4 Sliding pagination control implementation.
  5.  *
  6.  * View that can be used with the pagination module
  7.  * from the Twitter Bootstrap v4 CSS Toolkit
  8.  * https://v4-alpha.getbootstrap.com/components/pagination/
  9.  *
  10.  * @author Carlos Delgado <dev@ourcodeworld.com>
  11.  */
  12. #}
  13. {% if pageCount > 1 %}
  14.     <ul class="pagination">
  15.         {% if previous is defined %}
  16.             <li class="page-item">
  17.                 <a rel="prev" href="{{ path(route, query|merge({(pageParameterName): previous})) }}" class="page-link">&laquo;&nbsp; Précédent</a>
  18.             </li>
  19.         {% else %}
  20.             <li class="page-item disabled">
  21.                 <span class="page-link">&laquo;&nbsp; Précédent</span>
  22.             </li>
  23.         {% endif %}
  24.         {% if startPage > 1 %}
  25.             <li class="page-item">
  26.                 <a href="{{ path(route, query|merge({(pageParameterName): 1})) }}" class="page-link">1</a>
  27.             </li>
  28.             {% if startPage == 3 %}
  29.                 <li class="page-item">
  30.                     <a href="{{ path(route, query|merge({(pageParameterName): 2})) }}" class="page-link">2</a>
  31.                 </li>
  32.             {% elseif startPage != 2 %}
  33.                 <li class="page-item disabled">
  34.                     <span class="page-link">&hellip;</span>
  35.                 </li>
  36.             {% endif %}
  37.         {% endif %}
  38.         {% for page in pagesInRange %}
  39.             {% if page != current %}
  40.                 <li class="page-item">
  41.                     <a href="{{ path(route, query|merge({(pageParameterName): page})) }}" class="page-link">{{ page }}</a>
  42.                 </li>
  43.             {% else %}
  44.                 <li class="active page-item">
  45.                     <span class="page-link">{{ page }}</span>
  46.                 </li>
  47.             {% endif %}
  48.         {% endfor %}
  49.         {% if pageCount > endPage %}
  50.             {% if pageCount > (endPage + 1) %}
  51.                 {% if pageCount > (endPage + 2) %}
  52.                     <li class="page-item disabled">
  53.                         <span class="page-link">&hellip;</span>
  54.                     </li>
  55.                 {% else %}
  56.                     <li class="page-item">
  57.                         <a href="{{ path(route, query|merge({(pageParameterName): (pageCount - 1)})) }}" class="page-link">{{ pageCount -1 }}</a>
  58.                     </li>
  59.                 {% endif %}
  60.             {% endif %}
  61.             <li>
  62.                 <a href="{{ path(route, query|merge({(pageParameterName): pageCount})) }}" class="page-link">{{ pageCount }}</a>
  63.             </li>
  64.         {% endif %}
  65.         {% if next is defined %}
  66.             <li class="page-item">
  67.                 <a rel="next" class="page-link" href="{{ path(route, query|merge({(pageParameterName): next})) }}">Suivant&nbsp;&raquo;</a>
  68.             </li>
  69.         {% else %}
  70.             <li class="page-item disabled">
  71.                 <span class="page-link">Suivant&nbsp;&raquo;</span>
  72.             </li>
  73.         {% endif %}
  74.     </ul>
  75. {% endif %}