You are here

function theme_pager_link_item in Paging 6

Returns HTML for a link to a specific pageing page.

Parameters

$text: The link text.

$page_new: The first result to display on the linked page.

$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 link.

$attributes: An associative array of HTML attributes to apply to the pager link.

Return value

An HTML string that generates the link.

1 theme call to theme_pager_link_item()
paging_render_names in ./paging.module
Returns a rendered list of page links.

File

./paging.module, line 993
Allows users to use a tag to break up a node into multiple pages.

Code

function theme_pager_link_item($text, $page_new, $element, $parameters = array(), $attributes = array()) {
  $page = isset($_GET['page']) ? $_GET['page'] : '';
  if ($new_page = implode(',', pager_load_array($page_new[$element], $element, explode(',', $page)))) {
    $parameters['page'] = $new_page;
  }
  $query = array();
  if (isset($parameters['page'])) {
    $query['page'] = $parameters['page'];
  }
  $querystring = pager_get_querystring();
  if ($querystring != '') {
    $query[] = $querystring;
  }

  // Set active state for CSS.
  if ($page == $query['page']) {
    $attributes['class'] = 'pager-current';
  }
  return l($text, $_GET['q'], array(
    'attributes' => $attributes,
    'query' => count($query) ? implode('&', $query) : NULL,
  ));
}