public function Pagination::getPager in Pagination (Node) 7
Same name and namespace in other branches
- 6 pagination.module \Pagination::getPager()
Return a themed pager (Drupal default).
Return value
HTML corresponding to a themed Drupal pager.
File
- includes/
Pagination.inc, line 174
Class
- Pagination
- Handles all the pagination logic
Code
public function getPager() {
global $pager_page_array, $pager_total;
$pager_page_array = explode(',', (int) $this
->getPageVar());
$pager_total[0] = $this
->getPageCount();
$pager_page_array[0] = max(0, min((int) $pager_page_array[0], (int) $pager_total[0]));
$pager = theme('pager');
// Drupal default pager is 0 based, we'll use 1 based for ours
$regex = '#(\\?|\\&)page=(.+?)(\\"|&|/)#se';
$pager = preg_replace($regex, "'\$1page='.(\$2 + 1).''.stripslashes('\$3').''", $pager);
return $pager;
}