Skip to content

Commit

Permalink
Merge pull request #40 from slub/28-multiple-facettes-selectable
Browse files Browse the repository at this point in the history
28 multiple facettes selectable
  • Loading branch information
dikastes authored Feb 4, 2025
2 parents 0f0b648 + fb89741 commit 72a651f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Classes/Common/QueryParamsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ private static function retrieveFilterParamsForEntityType(
// show docs with count 0 only for multiple select fields
'min_doc_count' => $entityTypeMultiselect ? 0 : 1,
'size' => $entityTypeSize,
// 'include' => 'Slowakisch|.*',

]
]
],
Expand Down
5 changes: 5 additions & 0 deletions Classes/ViewHelpers/ProcessFacetsViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ public static function renderStatic(
return $item['doc_count'] > 0 || ($item['selected'] ?? false);
});

// Sort the array so that selected items come first
usort($returnBucket, function ($a, $b) {
return ($b['selected'] ?? false) <=> ($a['selected'] ?? false);
});

return $returnBucket;

}
Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/Partials/FilterBlock.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<f:if condition="{buckets -> f:count()} > 0">
<div class="filter-block frame">
<h4 class="">{f:translate(key: '{languageFilePath}:{key}', default: '{key}')}</h4>
<ul>
<ul style="view-transition-name:filterblock-{key};">
<f:for each="{buckets}" as="filter">
<f:render partial="FilterBlockItem" arguments="{key: key, filter: filter, searchParams: searchParams, searchParamsFromFirstPage: searchParamsFromFirstPage, languageFilePath: languageFilePath}" />
</f:for>
Expand Down
4 changes: 2 additions & 2 deletions Resources/Private/Templates/Search/Index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<div class="searchresults-info frame">
<div class="searchresults-info-total">
<output class="searchresults-total-items">{totalItems} {f:translate(key: 'searchResults_hits_label', extensionName: 'liszt_common')}</output>
<button class="filter-toggler btn" type="button" data-bs-toggle="offcanvas" data-bs-target="#filter-container" aria-controls="filter-container">
{f:translate(key: 'filter_container_label', extensionName: 'liszt_common')}
<button class="filter-toggler btn btn-black" type="button" data-bs-toggle="offcanvas" data-bs-target="#filter-container" aria-controls="filter-container">
<i:icon iconfig="lzicon,filter" preferredRenderTypes="svgSprite" additionalAttributes="{aria-hidden:'true'}" /> {f:translate(key: 'filter_container_label', extensionName: 'liszt_common')}
</button>
</div>

Expand Down

0 comments on commit 72a651f

Please sign in to comment.