function cleanpager_theme_pager_link in Clean Pagination 6
Same name and namespace in other branches
- 7 cleanpager.module \cleanpager_theme_pager_link()
Override theme for a pager link
1 string reference to 'cleanpager_theme_pager_link'
- cleanpager_theme_registry_alter in ./
cleanpager.module - Implementation of hook_theme_registry_alter().
File
- ./
cleanpager.module, line 121
Code
function cleanpager_theme_pager_link($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;
}
$cleanpage = cleanpager_check_match();
if ($cleanpage) {
unset($parameters['page']);
}
$query = array();
if (count($parameters)) {
$query[] = drupal_query_string_encode($parameters, array());
}
$querystring = pager_get_querystring();
if ($querystring != '') {
$query[] = $querystring;
}
// Set each pager link title
if (!isset($attributes['title'])) {
static $titles = NULL;
if (!isset($titles)) {
$titles = array(
t('« first') => t('Go to first page'),
t('‹ previous') => t('Go to previous page'),
t('next ›') => t('Go to next page'),
t('last »') => t('Go to last page'),
);
}
if (isset($titles[$text])) {
$attributes['title'] = $titles[$text];
}
else {
if (is_numeric($text)) {
$attributes['title'] = t('Go to page @number', array(
'@number' => $text,
));
}
}
}
$q = $_GET['q'];
if ($cleanpage) {
$q = cleanpager_path();
if (variable_get('cleanpager_use_additional_path', TRUE)) {
$cleanpage .= '/' . CLEANPAGER_ADDITIONAL_PATH_VARIABLE;
}
}
if (isset($new_page) && $cleanpage && $new_page > 0) {
if (variable_get('cleanpager_use_seo_links', '') == 1) {
$text = 'Visit ' . $q . ' Page ' . $text;
}
return l($text, $cleanpage . '/' . $new_page, array(
'attributes' => $attributes,
'query' => count($query) ? implode('&', $query) : NULL,
));
}
return l($text, $q, array(
'attributes' => $attributes,
'query' => count($query) ? implode('&', $query) : NULL,
));
}