diff --git a/core/includes/pager.inc b/core/includes/pager.inc index 9ead587..cef12ac 100644 --- a/core/includes/pager.inc +++ b/core/includes/pager.inc @@ -217,33 +217,39 @@ 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( - // @todo how to refactor theme suggestions '#theme' => 'link__pager__first' '#type' => 'link', '#title' => $tags[0], '#href' => $current_path, - // @todo is '#element' making any sense here? - '#element' => $element, '#options' => array( 'query' => pager_query_add_page($parameters, $element, 0), 'attributes' => array( 'title' => t('Go to first page'), 'rel' => 'first', ), + // Below is ignored by default, supplied to support hook_link_alter + // implementations. + 'pager_context' => array( + 'link_type' => 'first', + 'element' => $element, + ), ), ); $li_previous = array( - // @todo how to refactor theme suggestions '#theme' => 'link__pager__previous' '#type' => 'link', '#title' => $tags[1], '#href' => $current_path, - // @todo is '#element' making any sense here? - '#element' => $element, '#options' => array( '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, + ), ), ); } @@ -251,33 +257,39 @@ function template_preprocess_pager(&$variables) { // 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( - // @todo how to refactor theme suggestions '#theme' => 'link__pager__previous' '#type' => 'link', '#title' => $tags[3], '#href' => $current_path, - // @todo is '#element' making any sense here? - '#element' => $element, '#options' => array( '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_last = array( - // @todo how to refactor theme suggestions '#theme' => 'link__pager__last' '#type' => 'link', '#title' => $tags[4], '#href' => $current_path, - // @todo is '#element' making any sense here? - '#element' => $element, '#options' => array( 'query' => pager_query_add_page($parameters, $element, $pager_total[$element] - 1), 'attributes' => array( 'title' => t('Go to last page'), 'rel' => 'last', ), + // Below is ignored by default, supplied to support hook_link_alter + // implementations. + 'pager_context' => array( + 'link_type' => 'last', + 'element' => $element, + ), ), ); } @@ -311,7 +323,6 @@ function template_preprocess_pager(&$variables) { $items[] = array( '#wrapper_attributes' => array('class' => array('pager-item')), 'link' => array( - // @todo how to refactor theme suggestions '#theme' => 'link__pager' '#type' => 'link', '#title' => $i, '#href' => $current_path, @@ -320,13 +331,14 @@ function template_preprocess_pager(&$variables) { 'attributes' => array( 'title' => t('Go to page @number', array('@number' => $i)), ), + // Below is ignored by default, supplied to support hook_link_alter + // implementations. + 'pager_context' => array( + 'link_type' => 'item', + 'element' => $element, + 'interval' => ($pager_current - $i), + ), ), - // @todo is '#element' making any sense here? - '#element' => $element, - // Specify how many pages are between this item and the current page. - // Ignored by default, supplied for alternative implementations. - // @todo is '#interval' making any sense here? - '#interval' => ($pager_current - $i), ), ); } @@ -340,7 +352,6 @@ function template_preprocess_pager(&$variables) { $items[] = array( '#wrapper_attributes' => array('class' => array('pager-item')), 'link' => array( - // @todo how to refactor theme suggestions '#theme' => 'link__pager' '#type' => 'link', '#title' => $i, '#href' => $current_path, @@ -349,13 +360,14 @@ function template_preprocess_pager(&$variables) { 'attributes' => array( 'title' => t('Go to page @number', array('@number' => $i)), ), + // Below is ignored by default, supplied to support hook_link_alter + // implementations. + 'pager_context' => array( + 'link_type' => 'item', + 'element' => $element, + 'interval' => ($i - $pager_current), + ), ), - // @todo is '#element' making any sense here? - '#element' => $element, - // Specify how many pages are between this item and the current page. - // Ignored by default, supplied for alternative implementations. - // @todo is '#interval' making any sense here? - '#interval' => ($i - $pager_current), ), ); } diff --git a/core/modules/system/templates/pager.html.twig b/core/modules/system/templates/pager.html.twig index 92208bc..47b20a7 100644 --- a/core/modules/system/templates/pager.html.twig +++ b/core/modules/system/templates/pager.html.twig @@ -6,7 +6,6 @@ * Available variables: * - items: List of pager items. * - * @see template_preprocess() * @see template_preprocess_pager() * * @ingroup themeable diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc index c4a4997..411b776 100644 --- a/core/modules/views/views.theme.inc +++ b/core/modules/views/views.theme.inc @@ -1170,7 +1170,6 @@ function theme_views_mini_pager($vars) { $li_previous = array(); if ($pager_total[$element] > 1 && $pager_page_array[$element] > 0) { $li_previous = array( - // @todo how to refactor theme suggestions '#theme' => 'link__pager__previous' '#type' => 'link', '#title' => $tags[1], '#href' => $current_path, @@ -1180,6 +1179,13 @@ function theme_views_mini_pager($vars) { '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, + 'interval' => -1, + ), ), ); } @@ -1187,7 +1193,6 @@ function theme_views_mini_pager($vars) { $li_next = array(); if ($pager_page_array[$element] < ($pager_total[$element] - 1)) { $li_next = array( - // @todo how to refactor theme suggestions '#theme' => 'link__pager__next' '#type' => 'link', '#title' => $tags[3], '#href' => $current_path, @@ -1197,6 +1202,13 @@ function theme_views_mini_pager($vars) { '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' => 'previous', + 'element' => $element, + 'interval' => 1, + ), ), ); }