{%- block pager_widget -%} {%- endblock pager_widget -%} {%- block pager -%} {# Sequential pagers (i.e. cursor pagers) only link to the previous and next pages #} {%- if sequential is defined and sequential -%} {{- block('sequential_pager') -}} {%- else -%} {# Previous Page Link #} {%- if pagerfanta.hasPreviousPage() -%} {%- set path = route_generator.route(pagerfanta.getPreviousPage()) -%} {%- set page = pagerfanta.getPreviousPage() -%} {%- set relation = 'previous' -%} {{- block('previous_page_link') -}} {%- else -%} {{- block('previous_page_link_disabled') -}} {%- endif -%} {# First Page Link #} {%- if start_page > 1 -%} {%- set page = 1 -%} {%- set path = route_generator.route(page) -%} {%- set relation = 'page' -%} {{- block('page_link') -}} {%- endif -%} {# Second Page Link, displays if we are on page 3 #} {%- if start_page == 3 -%} {%- set page = 2 -%} {%- set path = route_generator.route(page) -%} {%- set relation = 'page' -%} {{- block('page_link') -}} {%- endif -%} {# Separator, creates a "..." separator to limit the number of items if we are starting beyond page 3 #} {%- if start_page > 3 -%} {{- block('ellipsis') -}} {%- endif -%} {# Page Links #} {%- for page in range(start_page, end_page) -%} {%- set path = route_generator.route(page) -%} {%- if page == current_page -%} {{- block('current_page_link') -}} {%- else -%} {%- set relation = 'page' -%} {{- block('page_link') -}} {%- endif -%} {%- endfor -%} {# Separator, creates a "..." separator to limit the number of items if we are over 3 pages away from the last page #} {%- if end_page < (nb_pages - 2) -%} {{- block('ellipsis') -}} {%- endif -%} {# Second to Last Page Link, displays if we are on the third from last page #} {%- if end_page == (nb_pages - 2) -%} {%- set page = (nb_pages - 1) -%} {%- set path = route_generator.route(page) -%} {%- set relation = 'page' -%} {{- block('page_link') -}} {%- endif -%} {# Last Page Link #} {%- if nb_pages > end_page -%} {%- set page = nb_pages -%} {%- set path = route_generator.route(page) -%} {%- set relation = 'page' -%} {{- block('page_link') -}} {%- endif -%} {# Next Page Link #} {%- if pagerfanta.hasNextPage() -%} {%- set path = route_generator.route(pagerfanta.getNextPage()) -%} {%- set page = pagerfanta.getNextPage() -%} {%- set relation = 'next' -%} {{- block('next_page_link') -}} {%- else -%} {{- block('next_page_link_disabled') -}} {%- endif -%} {%- endif -%} {%- endblock pager -%} {%- block sequential_pager -%} {# Previous Page Link, omitted when the pager cannot navigate backward #} {%- if supports_backward_navigation -%} {%- if previous_position is not null -%} {%- set path = route_generator.route(previous_position) -%} {%- set relation = 'previous' -%} {%- set position = previous_position -%} {%- set page = previous_page -%} {{- block('previous_page_link') -}} {%- else -%} {{- block('previous_page_link_disabled') -}} {%- endif -%} {%- endif -%} {# Next Page Link #} {%- if next_position is not null -%} {%- set path = route_generator.route(next_position) -%} {%- set relation = 'next' -%} {%- set position = next_position -%} {%- set page = next_page -%} {{- block('next_page_link') -}} {%- else -%} {{- block('next_page_link_disabled') -}} {%- endif -%} {%- endblock sequential_pager -%} {%- block page_link -%} {{- page -}} {%- endblock page_link -%} {%- block current_page_link -%} {{- page -}} {%- endblock current_page_link -%} {%- block previous_page_link -%} {%- endblock previous_page_link -%} {%- block previous_page_link_disabled -%} {{- block('previous_page_message') -}} {%- endblock previous_page_link_disabled -%} {%- block previous_page_message -%} {%- if options['prev_message'] is defined -%} {{- options['prev_message'] -}} {%- else -%} Previous {%- endif -%} {%- endblock previous_page_message -%} {%- block next_page_link -%} {%- endblock next_page_link -%} {%- block next_page_link_disabled -%} {{- block('next_page_message') -}} {%- endblock next_page_link_disabled -%} {%- block next_page_message -%} {%- if options['next_message'] is defined -%} {{- options['next_message'] -}} {%- else -%} Next {%- endif -%} {%- endblock next_page_message -%} {# Additional attributes for the link being rendered, rendered at the end of the link's opening tag #} {%- block link_attributes -%}{%- endblock link_attributes -%} {%- block ellipsis -%} … {%- endblock ellipsis -%}