function theme_pager_previous

Returns HTML for the "previous page" link in a query pager.

Parameters

$variables: An associative array containing:

  • text: The name (or image) of the link.
  • element: An optional integer to distinguish between multiple pagers on one page.
  • interval: The number of pages to move backward when the link is clicked.
  • parameters: An associative array of query string parameters to append to the pager links.

Related topics

1 theme call to theme_pager_previous()
theme_pager in includes/pager.inc
Returns HTML for a query pager.

File

includes/pager.inc, line 510

Code

function theme_pager_previous($variables) {
    $text = $variables['text'];
    $element = $variables['element'];
    $interval = $variables['interval'];
    $parameters = $variables['parameters'];
    global $pager_page_array;
    $output = '';
    // Nothing to do if there is no pager.
    if (!isset($pager_page_array[$element])) {
        return;
    }
    // If we are anywhere but the first page
    if ($pager_page_array[$element] > 0) {
        $page_new = pager_load_array($pager_page_array[$element] - $interval, $element, $pager_page_array);
        // If the previous page is the first page, mark the link as such.
        if ($page_new[$element] == 0) {
            $output = theme('pager_first', array(
                'text' => $text,
                'element' => $element,
                'parameters' => $parameters,
            ));
        }
        else {
            $output = theme('pager_link', array(
                'text' => $text,
                'page_new' => $page_new,
                'element' => $element,
                'parameters' => $parameters,
            ));
        }
    }
    return $output;
}

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