PaginatorHelper::meta() skips url parameters and disrespects defined routes

PaginatorHelper::meta() skips url parameters (passed and named) which results in urls not respecting defined routes.
It means PaginatorHelper::meta() does not generate same url as PaginatorHelper::prev() & PaginatorHelper::next().
This commit is contained in:
Mohsen 2015-10-07 15:07:37 +03:30
parent 19ad6dcef2
commit f57cdb7568

View file

@ -988,17 +988,18 @@ class PaginatorHelper extends AppHelper {
public function meta($options = array()) {
$model = isset($options['model']) ? $options['model'] : null;
$params = $this->params($model);
$urlOptions = isset($this->options['url']) ? $this->options['url'] : array();
$links = array();
if ($this->hasPrev()) {
$links[] = $this->Html->meta(array(
'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()) {
$links[] = $this->Html->meta(array(
'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);