You are here

function Pagination::getPager in Pagination (Node) 6

Same name and namespace in other branches
  1. 7 includes/Pagination.inc \Pagination::getPager()

@desc Get a themed pager (Drupal default)

Return value

string themed pager @public

File

./pagination.module, line 628
pagination.module @desc Allow for arbitrary nodes to be paginated. administrators can set which nodes they wish to paginate, and the length of content required to split a node into pages. Alternatively, content creators can set manual break points…

Class

Pagination
@desc Handles all the pagination logic

Code

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', null, 1, 0);

  // Drupal default pager is 0 based, we'll use 1 based for ours
  if (variable_get('pagination_onebased', 1)) {
    $regex = '#(\\?|\\&)page=(\\d+)#e';
    $pager = preg_replace($regex, "'\$1page='.(\$2 + 1)", $pager);
  }
  return $pager;
}