Hey,
is ist possible to show the text as label in Filtermenu?
categories:
type: select
options: query
query:
fetch: site.categories.toStructure
text: "{{ structureItem.category }}"
value: "{{ structureItem.category_url }}"
I also tried
categories:
type: select
options:
gaerten: Gärten
parks: Parks
and
categories:
type: select
options:
- value: 'gaerten'
text: Gärten
...
The filtermenu should use labels like: Gärten | Parks
The url/filter should use the value ...?filter=gaerten
<?php
$filterBy = get('filter');
$unfiltered = $page->children()->listed();
$projects= $unfiltered
->when($filterBy, function($filterBy) {
return $this->filterBy('categories', $filterBy);
});
$filters = $unfiltered->pluck('categories', ',', true);
?>
<nav>
<a href="<?= $page->url() ?>">All</a>
<?php foreach ($filters as $filter): ?>
<a href="<?= $page->url()?>?filter=<?= $filter ?>"><?= $filter ?></a>
<?php endforeach ?>
</nav>
I don’t know exactly what’s missing/wrong with the filter-controller.
Thank you.