Pager size not working

Created on 6 November 2017, over 6 years ago
Updated 8 December 2023, 7 months ago

Hi again :)

I noted the pager size wasn't working as expected.

Drupal actually has it's own built in pager theme function. I've converted the pager function to use it which should save a bit of code.

Let me know if there was a specific use case I didn't think of which the older code covered.

New function:

/**
 * Get a pager for the search results.
 *
 * @return string
 *   The pager HTML code.
 */
function bcse_get_pager($pageinfo) {
  $html = "<div class=\"item-list bing-custom-search-engine-pager\">\n";

  $per_page = $pageinfo['pagesize'];
  // Initialize the pager
  pager_default_initialize($pageinfo['totalresults'], $per_page);
  // Show the pager
  $html .= theme('pager', ['quantity' => $pageinfo['pagersize']]);

  $html .= "</div>\n";

  return $html;
}

I've wrapped up this change and the other mentioned in the attached zip file.

📌 Task
Status

Closed: outdated

Version

1.0

Component

Code

Created by

🇦🇺Australia camerongreen Brisbane

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024