diff --git a/config/vufind/searches.ini b/config/vufind/searches.ini index 3ed96c1210344fe28c2da1fbbc43c9b85ec521fb..ba223f0b9baffc782d74b48fc2ea74acde632210 100644 --- a/config/vufind/searches.ini +++ b/config/vufind/searches.ini @@ -192,6 +192,9 @@ CallNumber = callnumber ; standard facet settings (defaults to "Results" if not specified), ; and [checkbox facet section] is the name of a section of the ini file ; containing checkbox facet settings (leave blank for no checkbox facets). +; Checkbox facets are normally in filter => label format; prefix the section +; name with ~ to reverse this and use label => filter format (useful if your +; filters contain values that are illegal in configuration keys -- e.g. []). ; SummonDatabases:[GET parameter] ; Display Summon-generated database recommendations matching the terms found ; in the specified GET parameter. NOTE: If you are using this module with a diff --git a/module/VuFind/src/VuFind/Recommend/SideFacets.php b/module/VuFind/src/VuFind/Recommend/SideFacets.php index 5c274c81285e44e6e079eececcce8d037b552b02..181902b7339e556772120e4c8815a46c7da9e29c 100644 --- a/module/VuFind/src/VuFind/Recommend/SideFacets.php +++ b/module/VuFind/src/VuFind/Recommend/SideFacets.php @@ -77,9 +77,16 @@ class SideFacets implements RecommendInterface } // Checkbox facets: + if (substr($checkboxSection, 0, 1) == '~') { + $checkboxSection = substr($checkboxSection, 1); + $flipCheckboxes = true; + } $this->checkboxFacets = ($checkboxSection && isset($config->$checkboxSection)) ? $config->$checkboxSection->toArray() : array(); + if ($flipCheckboxes) { + $this->checkboxFacets = array_flip($this->checkboxFacets); + } } /**