Skip to content

Commit

Permalink
feat: also hide selected location from branch search facet
Browse files Browse the repository at this point in the history
The 'branch' facet, which can be added to the list of search facets to
be displayed, also contains locations (library branches) and therefore
must also be affected by the filter, which is what this commit
implements.
  • Loading branch information
Chloe070196 committed Jul 26, 2024
1 parent 909f2c5 commit f15c6a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions code/web/sys/SearchObject/GroupedWorkSearcher2.php
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ public function getFacetList($filter = null) {
// Get a list of branches so we can access their 'showInSearchFacet' value
// Also rename the keys to the branches' names so they can easily be accessed later
$branchList = null;
if ($field == 'available_at') {
if ($field == 'available_at' || $field == 'owning_location') {
$mainBranch = new Location();
$branchList = $mainBranch->getLocationListAsObjects(false);
// may need to be optimised / unsure how heavy this is
Expand All @@ -806,7 +806,7 @@ public function getFacetList($filter = null) {
// if populating the array of facet options for 'available at'
// then filter out any branch (location) for which showInSearchFacet has been set to "0"
// thus preventing these branches from being displayed as search by options
if ($field == 'available_at') {
if ($field == 'available_at' || $field == 'owning_location') {
$branchName = substr($facetValue, 5);
if (empty($branchList[$branchName]->showInSearchFacet)) {
continue;
Expand Down

0 comments on commit f15c6a7

Please sign in to comment.