diff --git a/config/vufind/facets.ini b/config/vufind/facets.ini index 5d7096df24fa2a5c88bc6cec49baaf408292ca26..a8eb0380da2f2e4040329c43f88634d9a5452d5a 100644 --- a/config/vufind/facets.ini +++ b/config/vufind/facets.ini @@ -23,6 +23,12 @@ publishDate = "adv_search_year" ; share year string w/advanced search pa [ResultsTop] topic_facet = "Suggested Topics" +; This section is used to specify labels for facets that may be applied by parts +; of VuFind other than the facet lists defined in this file (for example, the +; hierarchical browse of the BrowseController, or the Geographic Search). +[ExtraFacetLabels] +location_geo = "Geographic Search" + ; This section is used to identify facets for special treatment by the SideFacets ; recommendations module. [SpecialFacets] diff --git a/module/VuFind/src/VuFind/Search/Base/Params.php b/module/VuFind/src/VuFind/Search/Base/Params.php index 35b5e6954f9c1cfccfab1fd817c4a1ade77655c5..a14c0ef0af5be529888ba682d82bffa89b9c88b2 100644 --- a/module/VuFind/src/VuFind/Search/Base/Params.php +++ b/module/VuFind/src/VuFind/Search/Base/Params.php @@ -126,6 +126,13 @@ class Params implements ServiceLocatorAwareInterface */ protected $facetConfig = []; + /** + * Extra facet labels + * + * @var array + */ + protected $extraFacetLabels = []; + /** * Checkbox facet configuration * @@ -928,12 +935,16 @@ class Params implements ServiceLocatorAwareInterface public function getFacetLabel($field, $value = null) { if (!isset($this->facetConfig[$field]) + && !isset($this->extraFacetLabels[$field]) && isset($this->facetAliases[$field]) ) { $field = $this->facetAliases[$field]; } - return isset($this->facetConfig[$field]) - ? $this->facetConfig[$field] : 'unrecognized_facet_label'; + if (isset($this->facetConfig[$field])) { + return $this->facetConfig[$field]; + } + return isset($this->extraFacetLabels[$field]) + ? $this->extraFacetLabels[$field] : 'unrecognized_facet_label'; } /** diff --git a/module/VuFind/src/VuFind/Search/Solr/Params.php b/module/VuFind/src/VuFind/Search/Solr/Params.php index 9689a2d893bd900369351fcbacfd608bccfff1ee..98f921c9c19e1e44855313e6742122b68979b1d3 100644 --- a/module/VuFind/src/VuFind/Search/Solr/Params.php +++ b/module/VuFind/src/VuFind/Search/Solr/Params.php @@ -107,6 +107,9 @@ class Params extends \VuFind\Search\Base\Params if (isset($config->LegacyFields)) { $this->facetAliases = $config->LegacyFields->toArray(); } + if (isset($config->ExtraFacetLabels)) { + $this->extraFacetLabels = $config->ExtraFacetLabels->toArray(); + } if (isset($config->Results_Settings->facet_limit_by_field)) { foreach ($config->Results_Settings->facet_limit_by_field as $k => $v) { $this->facetLimitByField[$k] = $v;