function template_preprocess_pager

Prepares variables for pager templates.

Default template: pager.html.twig.

Menu callbacks that display paged query results should use #type => pager to retrieve a pager control so that users can view other results. Format a list of nearby pages with additional query results.

Parameters

array $variables: An associative array containing:

  • 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.
    • #pagination_heading_level: An optional heading level for the pager.
    • #parameters: An associative array of query string parameters to append to the pager links.
    • #route_parameters: An associative array of the route parameters.
    • #quantity: The number of pages in the list.

Deprecated

in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme().

See also

https://www.drupal.org/node/3504125

File

core/includes/theme.inc, line 973

Code

function template_preprocess_pager(&$variables) : void {
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. Initial template_preprocess functions are registered directly in hook_theme(). See https://www.drupal.org/node/3504125', E_USER_DEPRECATED);
  \Drupal::service(PagerPreprocess::class)->preprocessPager($variables);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.