templates/Resources/views/paginate/pagination.html.twig line 1

Open in your IDE?
  1. {#
  2. /**
  3.  * @file
  4.  * Twitter Bootstrap v4-beta.2 Sliding pagination control implementation.
  5.  *
  6.  * View that can be used with the pagination module
  7.  * from the Twitter Bootstrap CSS Toolkit
  8.  * https://getbootstrap.com/docs/4.4/components/pagination/
  9.  *
  10.  */
  11. #}
  12. {% if pageCount > 1 %}
  13.     {% set classAlign = (align is not defined) ? '' : align=='center' ? ' justify-content-center' : (align=='right' ? ' justify-content-end' : '') %}
  14.     {% set classSize = (size is not defined) ? '' : size=='large' ? ' pagination-lg' : (size=='small' ? ' pagination-sm' : '') %}
  15.     <ul class="pagination {{ classAlign }}{{ classSize }}">
  16.         {% if previous is defined %}
  17.             <li class="page-item">
  18.                 <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): previous})) }}"><i class="fa fa-angle-left"></i></a>
  19.             </li>
  20.         {% else %}
  21.             <li class="page-item">
  22.                 <span><a href="javascript:;"><i class="fa fa-angle-left"></i></a></span>
  23.             </li>
  24.         {% endif %}
  25.         {% if startPage > 1 %}
  26.             <li class="page-item">
  27.                 <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): 1})) }}">1</a>
  28.             </li>
  29.             {% if startPage == 3 %}
  30.                 <li class="page-item">
  31.                     <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): 2})) }}">2</a>
  32.                 </li>
  33.             {% elseif startPage != 2 %}
  34.                 <li class="page-item">
  35.                     <a href="#"><span>&hellip;</span></a>
  36.                 </li>
  37.             {% endif %}
  38.         {% endif %}
  39.         {% for page in pagesInRange %}
  40.             {% if page != current %}
  41.                 <li class="page-item">
  42.                     <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): page})) }}">{{ page }}</a>
  43.                 </li>
  44.             {% else %}
  45.                 <li class="active page-item"><a class="page-link" href="javascript:;">{{ page }}</a></li>
  46.             {% endif %}
  47.         {% endfor %}
  48.         {% if pageCount > endPage %}
  49.             {% if pageCount > (endPage + 1) %}
  50.                 {% if pageCount > (endPage + 2) %}
  51.                     <li class="page-item">
  52.                         <a href="#"><span>&hellip;</span></a>
  53.                     </li>
  54.                 {% else %}
  55.                     <li class="page-item">
  56.                         <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): (pageCount - 1)})) }}">{{ pageCount -1 }}</a>
  57.                     </li>
  58.                 {% endif %}
  59.             {% endif %}
  60.             <li class="page-item">
  61.                 <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): pageCount})) }}">{{ pageCount }}</a>
  62.             </li>
  63.         {% endif %}
  64.         {% if next is defined %}
  65.             <li class="page-item">
  66.                 <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): next})) }}"><i class="fa fa-angle-right"></i></a>
  67.             </li>
  68.         {% else %}
  69.             <li class="page-item">
  70.                 <span><a href="javascript:;"><i class="fa fa-angle-right"></i></a></span>
  71.             </li>
  72.         {% endif %}
  73.     </ul>
  74. {% endif %}