core/includes/pager.inc | 27 +++++++++++++++++---------- core/includes/theme.inc | 2 +- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/core/includes/pager.inc b/core/includes/pager.inc index 47bf398..9904409 100644 --- a/core/includes/pager.inc +++ b/core/includes/pager.inc @@ -164,17 +164,24 @@ function pager_get_query_parameters() { * * @param array $variables * An associative array containing: - * - tags: An array of labels for the controls in the pager. - * - element: An optional integer to distinguish between multiple pagers on - * one page. - * - parameters: An associative array of query string parameters to append to - * the pager links. - * - quantity: The number of pages in the list. + * - pager: A render element containing: + * - #tags: An array of labels for the controls in the pager. + * - #element: An optional integer to distinguish between multiple pagers on + * one page. + * - #parameters: An associative array of query string parameters to append to + * the pager links. + * - #quantity: The number of pages in the list. + * + * @throws \RuntimeException + * Whenever using #theme => pager instead of #type => pager. */ function template_preprocess_pager(&$variables) { - $element = $variables['element']; - $parameters = $variables['parameters']; - $quantity = $variables['quantity']; + if (!isset($variables['pager']['#type'])) { + throw new \RuntimeException("You must use '#type' => 'pager', not '#theme' => 'pager'."); + } + $element = $variables['pager']['#element']; + $parameters = $variables['pager']['#parameters']; + $quantity = $variables['pager']['#quantity']; global $pager_page_array, $pager_total; // Nothing to do if there is only one page. @@ -182,7 +189,7 @@ function template_preprocess_pager(&$variables) { return; } - $tags = $variables['tags']; + $tags = $variables['pager']['#tags']; // Calculate various markers within this pager piece: // Middle is used to "center" pages around the current page. diff --git a/core/includes/theme.inc b/core/includes/theme.inc index b6078ed..1ecd5e8 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1861,7 +1861,7 @@ function drupal_common_theme() { ), // From pager.inc. 'pager' => array( - 'variables' => array('tags' => array(), 'element' => 0, 'parameters' => array(), 'quantity' => 9), + 'render element' => 'pager', ), // From menu.inc. 'menu' => array(