Skip to content
Snippets Groups Projects
Commit fbb4b97b authored by Demian Katz's avatar Demian Katz
Browse files

Allow custom hidden filters for collections.

parent 29be7087
No related merge requests found
......@@ -63,3 +63,10 @@ title = sort_title
year = sort_year
year asc = "sort_year asc"
author = sort_author
; See searches.ini for documentation on these sections. Collections will always
; use the filters applied in searches.ini; any additional filters defined here
; will be combined with those existing filters. Use these if you want to apply
; additional filtering to records displayed in the collection context.
;[HiddenFilters]
;[RawHiddenFilters]
\ No newline at end of file
......@@ -90,6 +90,22 @@ class Params extends \VuFind\Search\Solr\Params
$safeId = addcslashes($this->collectionID, '"');
$this->addHiddenFilter($this->collectionField . ':"' . $safeId . '"');
$this->addHiddenFilter('!id:"' . $safeId . '"');
// Because the [HiddenFilters] and [RawHiddenFilters] settings for the
// Solr search backend come from searches.ini and are set up in the
// AbstractSolrBackendFactory, we need to account for additional ones
// from Collection.ini here.
$collectionConfig = $this->configLoader->get('Collection');
if (isset($collectionConfig->HiddenFilters)) {
foreach ($collectionConfig->HiddenFilters as $field => $value) {
$this->addHiddenFilter(sprintf('%s:"%s"', $field, $value));
}
}
if (isset($collectionConfig->RawHiddenFilters)) {
foreach ($collectionConfig->RawHiddenFilters as $current) {
$this->addHiddenFilter($current);
}
}
}
/**
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment