vendor/knplabs/knp-paginator-bundle/templates/Pagination/twitter_bootstrap_v4_pagination.html.twig line 1

  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 CSS Toolkit
  8.  * https://getbootstrap.com/docs/4.5/components/pagination/
  9.  *
  10.  */
  11. #}
  12. {% if pageCount > 1 %}
  13.     <nav>
  14.         {% set classAlign = (align is not defined) ? '' : align=='center' ? ' justify-content-center' : (align=='right' ? ' justify-content-end' : '') %}
  15.         {% set classSize = (size is not defined) ? '' : size=='large' ? ' pagination-lg' : (size=='small' ? ' pagination-sm' : '') %}
  16.         <ul class="pagination{{ classAlign }}{{ classSize }}">
  17.             {% if previous is defined %}
  18.                 <li class="page-item">
  19.                     <a class="page-link" rel="prev" href="{{ path(route, query|merge({(pageParameterName): previous})) }}">&laquo;&nbsp;{{ 'label_previous'|trans({}, 'KnpPaginatorBundle') }}</a>
  20.                 </li>
  21.             {% else %}
  22.                 <li class="page-item disabled">
  23.                     <span class="page-link">&laquo;&nbsp;{{ 'label_previous'|trans({}, 'KnpPaginatorBundle') }}</span>
  24.                 </li>
  25.             {% endif %}
  26.             {% if startPage > 1 %}
  27.                 <li class="page-item">
  28.                     <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): 1})) }}">1</a>
  29.                 </li>
  30.                 {% if startPage == 3 %}
  31.                     <li class="page-item">
  32.                         <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): 2})) }}">2</a>
  33.                     </li>
  34.                 {% elseif startPage != 2 %}
  35.                     <li class="page-item disabled">
  36.                         <span class="page-link">&hellip;</span>
  37.                     </li>
  38.                 {% endif %}
  39.             {% endif %}
  40.             {% for page in pagesInRange %}
  41.                 {% if page != current %}
  42.                     <li class="page-item">
  43.                         <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): page})) }}">{{ page }}</a>
  44.                     </li>
  45.                 {% else %}
  46.                     <li class="page-item active">
  47.                         <span class="page-link">{{ page }}</span>
  48.                     </li>
  49.                 {% endif %}
  50.             {% endfor %}
  51.             {% if pageCount > endPage %}
  52.                 {% if pageCount > (endPage + 1) %}
  53.                     {% if pageCount > (endPage + 2) %}
  54.                         <li class="page-item disabled">
  55.                             <span class="page-link">&hellip;</span>
  56.                         </li>
  57.                     {% else %}
  58.                         <li class="page-item">
  59.                             <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): (pageCount - 1)})) }}">{{ pageCount -1 }}</a>
  60.                         </li>
  61.                     {% endif %}
  62.                 {% endif %}
  63.                 <li class="page-item">
  64.                     <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): pageCount})) }}">{{ pageCount }}</a>
  65.                 </li>
  66.             {% endif %}
  67.             {% if next is defined %}
  68.                 <li class="page-item">
  69.                     <a class="page-link" rel="next" href="{{ path(route, query|merge({(pageParameterName): next})) }}">{{ 'label_next'|trans({}, 'KnpPaginatorBundle') }}&nbsp;&raquo;</a>
  70.                 </li>
  71.             {% else %}
  72.                 <li  class="page-item disabled">
  73.                     <span class="page-link">{{ 'label_next'|trans({}, 'KnpPaginatorBundle') }}&nbsp;&raquo;</span>
  74.                 </li>
  75.             {% endif %}
  76.         </ul>
  77.     </nav>
  78. {% endif %}