templates/bundles/KnpPaginatorBundle/Pagination/custom_pagination.html.twig line 1

  1. {% if pageCount > 1 %}
  2.     <nav>
  3.         {% set classAlign = (align is not defined) ? '' : align=='center' ? ' justify-content-center' : (align=='right' ? ' justify-content-end' : '') %}
  4.         {% set classSize = (size is not defined) ? '' : size=='large' ? ' pagination-lg' : (size=='small' ? ' pagination-sm' : '') %}
  5.         <ul class="pagination{{ classAlign }}{{ classSize }}">
  6.             {% if previous is defined %}
  7.                 <li class="previtem">
  8.                     <a class="page-link" rel="prev" href="{{ path(route, query|merge({(pageParameterName): previous})) }}">
  9.                         &laquo;&nbsp;{{ 'label_previous'|trans({}, 'KnpPaginatorBundle') }}
  10.                     </a>
  11.                 </li>
  12.             {% else %}
  13.                 <li class="previtem disabled">
  14.                     <a class="page-link" rel="prev" href="#">
  15.                         &laquo;&nbsp;{{ 'label_previous'|trans({}, 'KnpPaginatorBundle') }}
  16.                     </a>
  17.                 </li>
  18.             {% endif %}
  19.             <li class="justify-content-center pagination-center">
  20.                 <div class="page-group">
  21.                     <ul>
  22.                         {% if startPage > 1 %}
  23.                             <li class="page-item">
  24.                                 <a class="page-link"
  25.                                    href="{{ path(route, query|merge({(pageParameterName): 1})) }}">1</a>
  26.                             </li>
  27.                             {% if startPage == 3 %}
  28.                                 <li class="page-item">
  29.                                     <a class="page-link"
  30.                                        href="{{ path(route, query|merge({(pageParameterName): 2})) }}">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 class="page-link" href="{{ path(route, query|merge({(pageParameterName): page})) }}">
  42.                                         {{ page }}
  43.                                     </a>
  44.                                 </li>
  45.                             {% else %}
  46.                                 <li class="page-item">
  47.                                     <a class="active page-link" href="#">
  48.                                         {{ page }}
  49.                                     </a>
  50.                                 </li>
  51.                             {% endif %}
  52.                         {% endfor %}
  53.                         {% if pageCount > endPage %}
  54.                             {% if pageCount > (endPage + 1) %}
  55.                                 {% if pageCount > (endPage + 2) %}
  56.                                     <li class="page-item disabled">
  57.                                         <span class="page-link">&hellip;</span>
  58.                                     </li>
  59.                                 {% else %}
  60.                                     <li class="page-item">
  61.                                         <a class="page-link"
  62.                                            href="{{ path(route, query|merge({(pageParameterName): (pageCount - 1)})) }}">{{ pageCount -1 }}</a>
  63.                                     </li>
  64.                                 {% endif %}
  65.                             {% endif %}
  66.                             <li class="page-item">
  67.                                 <a class="page-link"
  68.                                    href="{{ path(route, query|merge({(pageParameterName): pageCount})) }}">{{ pageCount }}</a>
  69.                             </li>
  70.                         {% endif %}
  71.                     </ul>
  72.                 </div>
  73.             </li>
  74.             {% if next is defined %}
  75.                 <li class="nextlink">
  76.                     <a class="page-link" rel="next" href="{{ path(route, query|merge({(pageParameterName): next})) }}">
  77.                         {{ 'label_next'|trans({}, 'KnpPaginatorBundle') }}
  78.                         &nbsp;&raquo;
  79.                     </a>
  80.                 </li>
  81.             {% else %}
  82.                 <li class="nextlink disabled">
  83.                     <a class="page-link" rel="next" href="#">
  84.                         {{ 'label_next'|trans({}, 'KnpPaginatorBundle') }}&nbsp;&raquo;
  85.                     </a>
  86.                 </li>
  87.             {% endif %}
  88.         </ul>
  89.     </nav>
  90. {% endif %}