fix: fixed pagination issues with the taxonomy view, fixes #1660

pull/1670/head
Iglocska 2016-11-10 17:20:50 +01:00
parent abd288d842
commit d26cebd8c6
1 changed files with 4 additions and 0 deletions

View File

@ -46,11 +46,15 @@ class TaxonomiesController extends AppController {
App::uses('CustomPaginationTool', 'Tools');
$filter = isset($this->passedArgs['filter']) ? $this->passedArgs['filter'] : false;
$taxonomy = $this->Taxonomy->getTaxonomy($id, array('full' => true, 'filter' => $filter));
foreach ($taxonomy['entries'] as $key => $value) {
$taxonomy['entries'][$key]['events'] = count($value['existing_tag']['EventTag']);
}
$this->set('filter', $filter);
if (empty($taxonomy)) throw new NotFoundException('Taxonomy not found.');
$customPagination = new CustomPaginationTool();
$params = $customPagination->createPaginationRules($taxonomy['entries'], $this->passedArgs, 'TaxonomyEntry');
$this->params->params['paging'] = array($this->modelClass => $params);
$params = $customPagination->applyRulesOnArray($taxonomy['entries'], $params, 'taxonomies');
$customPagination->truncateByPagination($taxonomy['entries'], $params);
$this->set('entries', $taxonomy['entries']);
$this->set('urlparams', $urlparams);