You are here

function theme_gss_pager in Google Site Search 7

Returns HTML for a query pager.

Menu callbacks that display paged query results should call theme('gss_pager') to retrieve a pager control so that users can view other results.

Display the mini pager with only Next/Previous Button.

Parameters

$variables: An associative array containing:

  • tags: An array of labels for the controls in the pager.
  • element: An optional integer to distinguish between multiple pagers on one page.
  • parameters: An associative array of query string parameters to append to the pager links.
1 theme call to theme_gss_pager()
GoogleSiteSearch::getPager in includes/GoogleSiteSearch.inc
Get a pager for the search results.

File

./gss.theme.inc, line 102
Themeable functions for Google Site Search.

Code

function theme_gss_pager($variables) {
  $tags = $variables['tags'];
  $element = $variables['element'];
  $parameters = $variables['parameters'];
  global $pager_page_array, $pager_total;

  // Current is the page we are currently paged to.
  $pager_current = $pager_page_array[$element] + 1;

  // End of generation loop preparation.
  $li_previous = theme('pager_previous', array(
    'text' => isset($tags[1]) ? $tags[1] : t('‹ previous'),
    'element' => $element,
    'interval' => 1,
    'parameters' => $parameters,
  ));
  $li_next = theme('pager_next', array(
    'text' => isset($tags[3]) ? $tags[3] : t('next ›'),
    'element' => $element,
    'interval' => 1,
    'parameters' => $parameters,
  ));
  if ($pager_total[$element] > 1) {
    if ($li_previous) {
      $items[] = array(
        'class' => array(
          'pager-previous',
        ),
        'data' => $li_previous,
      );
    }
    $items[] = array(
      'class' => array(
        'pager-current',
      ),
      'data' => t('You are on page @current', array(
        '@current' => $pager_current,
      )),
    );

    // End generation.
    if ($li_next) {
      $items[] = array(
        'class' => array(
          'pager-next',
        ),
        'data' => $li_next,
      );
    }
    return '<h2 class="element-invisible">' . t('Pages') . '</h2>' . theme('item_list', array(
      'items' => $items,
      'attributes' => array(
        'class' => array(
          'pager',
        ),
      ),
    ));
  }
}