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

Fixed facet translation bugs.

parent 863fc6a4
No related merge requests found
......@@ -136,7 +136,7 @@ orFacets = *
; 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
; 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
; 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
public function __construct(\VuFind\Config\PluginManager $configLoader,
$apiInfo = null
) {
$this->searchIni = 'EDS';
$this->searchIni = $this->facetsIni = 'EDS';
$searchSettings = $configLoader->get($this->searchIni);
parent::__construct($configLoader);
$this->viewOptions = [
......@@ -134,6 +134,14 @@ class Options extends \VuFind\Search\Base\Options
$this->apiInfo = $apiInfo;
$this->setOptionsFromApi($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
// an active filter for the current field?
$orField = '~' . $field;
$itemsToCheck = isset($filterList[$field])
? $filterList[$field] : [];
? $filterList[$field] : [];
if (isset($filterList[$orField])) {
$itemsToCheck += $filterList[$orField];
}
......@@ -139,14 +139,12 @@ class Results extends \VuFind\Search\Base\Results
// Create display value:
$current['counts'][$facetIndex]['displayText'] = $translate
? $this->translate($facetDetails['displayText'])
: $facetDetails['displayText'];
? $this->translate($facetDetails['displayText'])
: $facetDetails['displayText'];
// Create display value:
$current['counts'][$facetIndex]['value'] = $translate
? $this->translate($facetDetails['value'])
: $facetDetails['value'];
$current['counts'][$facetIndex]['value']
= $facetDetails['value'];
}
// The EDS API returns facets in the order they should be displayed
$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