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

Fixed facet translation bugs.

parent 863fc6a4
Branches
Tags
No related merge requests found
...@@ -136,7 +136,7 @@ orFacets = * ...@@ -136,7 +136,7 @@ orFacets = *
; translated facets, be sure that all of the necessary strings are included in the ; translated facets, be sure that all of the necessary strings are included in the
; language files found in the web/lang directory. By default, no facets are ; language files found in the web/lang directory. By default, no facets are
; translated -- uncomment or add lines below to turn on this feature. ; translated -- uncomment or add lines below to turn on this feature.
;translated_facets[] = ContentType ;translated_facets[] = SourceType
; This section shows which search types will display in the basic search box at ; This section shows which search types will display in the basic search box at
; the top of EDS pages. The name of each setting below corresponds with an ; the top of EDS pages. The name of each setting below corresponds with an
......
...@@ -124,7 +124,7 @@ class Options extends \VuFind\Search\Base\Options ...@@ -124,7 +124,7 @@ class Options extends \VuFind\Search\Base\Options
public function __construct(\VuFind\Config\PluginManager $configLoader, public function __construct(\VuFind\Config\PluginManager $configLoader,
$apiInfo = null $apiInfo = null
) { ) {
$this->searchIni = 'EDS'; $this->searchIni = $this->facetsIni = 'EDS';
$searchSettings = $configLoader->get($this->searchIni); $searchSettings = $configLoader->get($this->searchIni);
parent::__construct($configLoader); parent::__construct($configLoader);
$this->viewOptions = [ $this->viewOptions = [
...@@ -134,6 +134,14 @@ class Options extends \VuFind\Search\Base\Options ...@@ -134,6 +134,14 @@ class Options extends \VuFind\Search\Base\Options
$this->apiInfo = $apiInfo; $this->apiInfo = $apiInfo;
$this->setOptionsFromApi($searchSettings); $this->setOptionsFromApi($searchSettings);
$this->setOptionsFromConfig($searchSettings); $this->setOptionsFromConfig($searchSettings);
$facetConf = $configLoader->get($this->facetsIni);
if (isset($facetConf->Advanced_Facet_Settings->translated_facets)
&& count($facetConf->Advanced_Facet_Settings->translated_facets) > 0
) {
foreach ($facetConf->Advanced_Facet_Settings->translated_facets as $c) {
$this->translatedFacets[] = $c;
}
}
} }
/** /**
......
...@@ -124,7 +124,7 @@ class Results extends \VuFind\Search\Base\Results ...@@ -124,7 +124,7 @@ class Results extends \VuFind\Search\Base\Results
// an active filter for the current field? // an active filter for the current field?
$orField = '~' . $field; $orField = '~' . $field;
$itemsToCheck = isset($filterList[$field]) $itemsToCheck = isset($filterList[$field])
? $filterList[$field] : []; ? $filterList[$field] : [];
if (isset($filterList[$orField])) { if (isset($filterList[$orField])) {
$itemsToCheck += $filterList[$orField]; $itemsToCheck += $filterList[$orField];
} }
...@@ -139,14 +139,12 @@ class Results extends \VuFind\Search\Base\Results ...@@ -139,14 +139,12 @@ class Results extends \VuFind\Search\Base\Results
// Create display value: // Create display value:
$current['counts'][$facetIndex]['displayText'] = $translate $current['counts'][$facetIndex]['displayText'] = $translate
? $this->translate($facetDetails['displayText']) ? $this->translate($facetDetails['displayText'])
: $facetDetails['displayText']; : $facetDetails['displayText'];
// Create display value: // Create display value:
$current['counts'][$facetIndex]['value'] = $translate $current['counts'][$facetIndex]['value']
? $this->translate($facetDetails['value']) = $facetDetails['value'];
: $facetDetails['value'];
} }
// The EDS API returns facets in the order they should be displayed // The EDS API returns facets in the order they should be displayed
$current['label'] = isset($filter[$field]) $current['label'] = isset($filter[$field])
......
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