mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-18 23:49:55 +00:00
Merge pull request #7516 into 2.7
PaginatorHelper::meta() skips url parameters (passed and named) which results in urls not respecting defined routes. It means PaginatorHelper::meta() does not generate same urls as PaginatorHelper::prev() & PaginatorHelper::next(). Refs #7516
This commit is contained in:
commit
7bf6768066
1 changed files with 3 additions and 2 deletions
|
@ -988,17 +988,18 @@ class PaginatorHelper extends AppHelper {
|
||||||
public function meta($options = array()) {
|
public function meta($options = array()) {
|
||||||
$model = isset($options['model']) ? $options['model'] : null;
|
$model = isset($options['model']) ? $options['model'] : null;
|
||||||
$params = $this->params($model);
|
$params = $this->params($model);
|
||||||
|
$urlOptions = isset($this->options['url']) ? $this->options['url'] : array();
|
||||||
$links = array();
|
$links = array();
|
||||||
if ($this->hasPrev()) {
|
if ($this->hasPrev()) {
|
||||||
$links[] = $this->Html->meta(array(
|
$links[] = $this->Html->meta(array(
|
||||||
'rel' => 'prev',
|
'rel' => 'prev',
|
||||||
'link' => $this->url(array('page' => $params['page'] - 1), true)
|
'link' => $this->url(array_merge($urlOptions, array('page' => $params['page'] - 1)), true)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if ($this->hasNext()) {
|
if ($this->hasNext()) {
|
||||||
$links[] = $this->Html->meta(array(
|
$links[] = $this->Html->meta(array(
|
||||||
'rel' => 'next',
|
'rel' => 'next',
|
||||||
'link' => $this->url(array('page' => $params['page'] + 1), true)
|
'link' => $this->url(array_merge($urlOptions, array('page' => $params['page'] + 1)), true)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
$out = implode($links);
|
$out = implode($links);
|
||||||
|
|
Loading…
Add table
Reference in a new issue