{% block paging %} {% set pages = paginator.getPaginationData() %} {% set label = label|default('sr.pagination-navigation'|trans) %} {% set prevLabel = prevLabel|default('sr.pagination.previous'|trans) %} {% set leftIcon = leftIcon|default('icon icon-arrow-left') %} {% set nextLabel = nextLabel|default('sr.pagination.next'|trans) %} {% set rightIcon = rightIcon|default('icon icon-arrow-right') %} {% set ajaxPaging = ajaxPaging|default(false) %} {% set className = className|default('') %} {% set addClassArray = [] %} {% set showCount = showCount|default(false) %} {% if addClass is defined %} {% set addClassArray = addClassArray|merge([addClass]) %} {% endif %} {% set hashSuffix = '' %} {% if hashtag is defined and hashtag is not empty %} {% set hashSuffix = '#' ~ hashtag %} {% endif %} {% if pages.pageCount > 1 %} <nav class="{{ className }}" aria-label="{{ label }}"> <ul class="pagination"> {% if pages.previous is defined %} {% if object is defined %} {% set prevUrl = pimcore_url({'object': object, 'page': pages.previous}) %} {% else %} {% set prevUrl = pimcore_url({'page': pages.previous}) %} {% if pages.previous == 1 %} {% set prevUrl = elements_page_1_query(prevUrl, object|default(null)) %} {% endif %} {% endif %} {% do pimcore_placeholder('headPrev').set('<link rel="prev" href="' ~ prevUrl ~ '">') %} <li class="page-item page-item--arrow"> <a href="{{ prevUrl ~ hashSuffix }}" class="page-link {{ ajaxPaging ? 'js-ajax-form__link' }}" rel="prev" aria-label="{{ prevLabel }}"> <span class="icon {{ leftIcon }}" aria-hidden="true"></span> </a> </li> {% else %} <li class="page-item page-item--arrow disabled"> <a class="page-link" href="#"> <span class="icon {{ leftIcon }}" aria-hidden="true"></span> </a> </li> {% endif %} {% if showFirstLast is defined and showFirstLast is not empty %} {% if pages.firstPageInRange != pages.first %} {% if object is defined %} {% set firstUrl = pimcore_url({'object': object, 'page': 1}) %} {% else %} {% set firstUrl = elements_page_1_query(pimcore_url({'page': 1})) %} {% endif %} <li class="page-item"> <a class="page-link {{ ajaxPaging ? 'js-ajax-form__link' }}" href="{{ firstUrl ~ hashSuffix }}" data-page="{{ pages.first }}"> {{ pages.first }} </a> </li> {% endif %} {% if pages.firstPageInRange > pages.first + 1 and pages.firstPageInRange < pages.first + 3 %} {% if object is defined %} {% set firstPlusOneUrl = pimcore_url({'object': object, 'page': pages.first + 1}) %} {% else %} {% set firstPlusOneUrl = pimcore_url({'page': pages.first + 1}) %} {% endif %} <li class="page-item"> <a class="page-link {{ ajaxPaging ? 'js-ajax-form__link' }}" href="{{ firstPlusOneUrl ~ hashSuffix }}" data-page="{{ pages.first + 1 }}"> {{ pages.first + 1 }} </a> </li> {% endif %} {% if pages.firstPageInRange > pages.first + 2 %} <li class="disabled page-item"> <a class="page-link" href="#">...</a> </li> {% endif %} {% endif %} {% for page in pages.pagesInRange %} {% if object is defined %} {% set pageUrl = pimcore_url({'object': object, 'page': page}) %} {% else %} {% set pageUrl = pimcore_url({'page': page}) %} {% endif %} {% if page == 1 %} {% set pageUrl = elements_page_1_query(pageUrl, object|default(null)) %} {% endif %} {% if page != pages.current %} <li class="page-item"> <a class="page-link {{ ajaxPaging ? 'js-ajax-form__link' }}" href="{{ pageUrl ~ hashSuffix }}" data-page="{{ page }}"> {{ page }} </a> </li> {% else %} <li class="active page-item" aria-current="page"> <a class="page-link {{ ajaxPaging ? 'js-ajax-form__link' }}" href="#" data-page="{{ page }}"> <span class="sr-only">{{ page }}</span> </a> </li> {% endif %} {% endfor %} {% if showFirstLast is defined and showFirstLast is not empty %} {% if pages.lastPageInRange < pages.last - 2 %} <li class="disabled page-item"> <a class="page-link" href="#">...</a> </li> {% endif %} {% if pages.lastPageInRange < pages.last - 1 and pages.lastPageInRange > pages.last - 3 %} {% if object is defined %} {% set lastMinusOneUrl = pimcore_url({'object': object, 'page': pages.last - 1}) %} {% else %} {% set lastMinusOneUrl = pimcore_url({'page': pages.last - 1}) %} {% endif %} <li class="page-item"> <a class="page-link {{ ajaxPaging ? 'js-ajax-form__link' }}" href="{{ lastMinusOneUrl ~ hashSuffix }}" data-page="{{ pages.last - 1 }}"> {{ pages.last - 1 }} </a> </li> {% endif %} {% if pages.lastPageInRange != pages.last %} {% if object is defined %} {% set lastUrl = pimcore_url({'object': object, 'page': pages.last}) %} {% else %} {% set lastUrl = pimcore_url({'page': pages.last}) %} {% endif %} <li class="page-item"> <a class="page-link {{ ajaxPaging ? 'js-ajax-form__link' }}" href="{{ lastUrl ~ hashSuffix }}" data-page="{{ pages.last }}"> {{ pages.last }} </a> </li> {% endif %} {% endif %} {% if pages.next is defined %} {% if object is defined %} {% set nextUrl = pimcore_url({'object': object, 'page': pages.next}) %} {% else %} {% set nextUrl = pimcore_url({'page': pages.next}) %} {% endif %} {% do pimcore_placeholder('headNext').set('<link rel="next" href="' ~ nextUrl ~ '">') %} <li class="page-item li-has-arrow"> <a class="page-link {{ ajaxPaging ? 'js-ajax-form__link' }}" href="{{ nextUrl ~ hashSuffix }}" data-page="{{ pages.next }}" rel="next" aria-label="{{ nextLabel }}"> <span class="icon {{ rightIcon }}" aria-hidden="true"></span> </a> </li> {% else %} <li class="page-item li-has-arrow disabled"> <a class="page-link" href="#"> <span class="icon {{ rightIcon }}" aria-hidden="true"></span> </a> </li> {% endif %} </ul> {% endif %}{% endblock %}