Hello,
Congratulations for the new videos on Kirby’s youtube Channel. They are a great help!
I’ve created a filter menu, following your youtube channel and it works great.
However, when I add two ou more categories to a project, the filters won’t work and appear together with commas.
Any tips on how to solve this?
My controller:
<?php
return function ($page) {
$filterBy = get('filter');
$unfiltered = $page->children()->listed();
$projects = $unfiltered
->when($filterBy, function($filterBy){
return $this->filterBy('category', $filterBy);
})
->paginate(20);
$pagination = $projects->pagination();
$filters = $unfiltered->pluck('category', null, true);
return [
'filterBy' => $filterBy,
'unfiltered' => $unfiltered,
'projects' => $projects,
'pagination' => $pagination,
'filters' => $filters
];
};
Thank you.
Best,
João