- #32603: Clean up theme_pager_link (drumm)
parent
c0525a7c18
commit
a9260fa2cd
|
@ -356,23 +356,19 @@ function theme_pager_list($limit, $element = 0, $quantity = 5, $text = '', $attr
|
||||||
* An HTML string that generates the link.
|
* An HTML string that generates the link.
|
||||||
*/
|
*/
|
||||||
function theme_pager_link($text, $page_new, $element, $attributes = array()) {
|
function theme_pager_link($text, $page_new, $element, $attributes = array()) {
|
||||||
$q = $_GET['q'];
|
$page = isset($_GET['page']) ? $_GET['page'] : '';
|
||||||
$page = array_key_exists('page', $_GET) ? $_GET['page'] : '';
|
if ($new_page = implode(',', pager_load_array($page_new[$element], $element, explode(',', $page)))) {
|
||||||
|
$attributes['page'] = $new_page;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = array();
|
||||||
foreach ($attributes as $key => $value) {
|
foreach ($attributes as $key => $value) {
|
||||||
$query[] = $key .'='. $value;
|
$query[] = $key .'='. $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
$page_new = pager_load_array($page_new[$element], $element, explode(',', $page));
|
return l($text, $_GET['q'], array(), count($query) ? implode('&', $query) : NULL);
|
||||||
if (count($attributes)) {
|
|
||||||
$url = url($q, 'page='. implode(',', $page_new) .'&'. implode('&', $query));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$url = url($q, 'page='. implode(',', $page_new));
|
|
||||||
}
|
|
||||||
|
|
||||||
return '<a href="'. check_url($url) .'">'. check_plain($text) .'</a>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @} End of "Pager pieces".
|
* @} End of "Pager pieces".
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue