diff --git a/core/includes/pager.inc b/core/includes/pager.inc index 4af6d88..1732f6c 100644 --- a/core/includes/pager.inc +++ b/core/includes/pager.inc @@ -185,13 +185,9 @@ function template_preprocess_pager(&$variables) { // Fill in default link labels. $tags = &$variables['tags']; $tags += array( - t('First page'), - t('Previous page'), - t('Current page'), - t('Next page'), - t('Last page'), t('« first'), t('‹ prev'), + '', t('next ›'), t('last »'), ); @@ -231,84 +227,40 @@ function template_preprocess_pager(&$variables) { // Create the "first" and "previous" links if we are not on the first page. if ($pager_page_array[$element] > 0) { - $li_first = array( - '#type' => 'link', - '#title' => '' . $tags[0] . '', - '#href' => $current_path, - '#options' => array( - 'html' => TRUE, - 'query' => pager_query_add_page($parameters, $element, 0), - 'attributes' => array( - 'title' => t('Go to first page'), - ), - // Below is ignored by default, supplied to support hook_link_alter - // implementations. - 'pager_context' => array( - 'link_type' => 'first', - 'element' => $element, - ), - ), + $li_first = array(); + $options = array( + 'query' => pager_query_add_page($parameters, $element, 0), ); - $li_previous = array( - '#type' => 'link', - '#title' => '' . $tags[2] . '', - '#href' => $current_path, - '#options' => array( - 'html' => TRUE, - 'query' => pager_query_add_page($parameters, $element, $pager_page_array[$element] - 1), - 'attributes' => array( - 'title' => t('Go to previous page'), - 'rel' => 'prev', - ), - // Below is ignored by default, supplied to support hook_link_alter - // implementations. - 'pager_context' => array( - 'link_type' => 'previous', - 'element' => $element, - ), - ), + $li_first['href'] = url($current_path, $options); + $li_first['text'] = $tags[0]; + $li_first['attributes'] = new Attribute(array('title' => t('Go to first page'))); + + $li_previous = array(); + $options = array( + 'query' => pager_query_add_page($parameters, $element, $pager_page_array[$element] - 1), ); + $li_previous['href'] = url($current_path, $options); + $li_previous['text'] = $tags[1]; + $li_previous['attributes'] = new Attribute(array('title' => t('Go to previous page'))); } // Create the "last" and "next" links if we are not on the last page. if ($pager_page_array[$element] < ($pager_total[$element] - 1)) { - $li_next = array( - '#type' => 'link', - '#title' => '' . $tags[3] . '', - '#href' => $current_path, - '#options' => array( - 'html' => TRUE, - 'query' => pager_query_add_page($parameters, $element, $pager_page_array[$element] + 1), - 'attributes' => array( - 'title' => t('Go to next page'), - 'rel' => 'next', - ), - // Below is ignored by default, supplied to support hook_link_alter - // implementations. - 'pager_context' => array( - 'link_type' => 'next', - 'element' => $element, - ), - ), + $li_next = array(); + $options = array( + 'query' => pager_query_add_page($parameters, $element, $pager_page_array[$element] + 1), ); - $li_last = array( - '#type' => 'link', - '#title' =>'' . $tags[4] . '', - '#href' => $current_path, - '#options' => array( - 'html' => TRUE, - 'query' => pager_query_add_page($parameters, $element, $pager_total[$element] - 1), - 'attributes' => array( - 'title' => t('Go to last page'), - ), - // Below is ignored by default, supplied to support hook_link_alter - // implementations. - 'pager_context' => array( - 'link_type' => 'last', - 'element' => $element, - ), - ), + $li_next['href'] = url($current_path, $options); + $li_next['text'] = $tags[3]; + $li_next['attributes'] = new Attribute(array('title' => t('Go to next page'))); + + $li_last = array(); + $options = array( + 'query' => pager_query_add_page($parameters, $element, $pager_total[$element] - 1), ); + $li_last['href'] = url($current_path, $options); + $li_last['text'] = $tags[4]; + $li_last['attributes'] = new Attribute(array('title' => t('Go to last page'))); } if ($pager_total[$element] > 1) { @@ -327,32 +279,13 @@ function template_preprocess_pager(&$variables) { } // Now generate the actual pager piece. for (; $i <= $pager_last && $i <= $pager_max; $i++) { - $link_title = '' . t('Page') . ' ' . $i; - $title_attribute = t('Go to page @number', array('@number' => $i)); + $options = array( + 'query' => pager_query_add_page($parameters, $element, $i - 1), + ); + $items['pages'][$i]['href'] = url($current_path, $options); if ($i == $pager_current) { $items['current'] = $i; - $link_title = '' . $tags[2] . ' ' . $i; - $title_attribute = $tags[2]; } - $items['pages'][$i] = array( - '#type' => 'link', - '#title' => $link_title, - '#href' => $current_path, - '#options' => array( - 'html' => TRUE, - 'query' => pager_query_add_page($parameters, $element, $i - 1), - 'attributes' => array( - 'title' => $title_attribute, - ), - // Below is ignored by default, supplied to support hook_link_alter - // implementations. - 'pager_context' => array( - 'link_type' => 'item', - 'element' => $element, - 'interval' => abs($pager_current - $i), - ), - ), - ); } // Check whether there are further next pages. if ($i < $pager_max) { diff --git a/core/modules/system/templates/pager.html.twig b/core/modules/system/templates/pager.html.twig index f5cd355..1a92b01 100644 --- a/core/modules/system/templates/pager.html.twig +++ b/core/modules/system/templates/pager.html.twig @@ -16,26 +16,61 @@

{{ 'Pagination'|t }}

{% endif %} +