From 6681147026303348553cd7508c6f4f7fe142c73a Mon Sep 17 00:00:00 2001 From: Ere Maijala <ere.maijala@helsinki.fi> Date: Mon, 22 May 2017 16:51:37 +0300 Subject: [PATCH] Fixed multiple accesses of undefined variables in the facet templates. (#969) --- themes/bootstrap3/templates/Recommend/SideFacets.phtml | 8 +++++++- .../Recommend/SideFacets/hierarchical-facet.phtml | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/themes/bootstrap3/templates/Recommend/SideFacets.phtml b/themes/bootstrap3/templates/Recommend/SideFacets.phtml index 7116b00d252..abe370c8969 100644 --- a/themes/bootstrap3/templates/Recommend/SideFacets.phtml +++ b/themes/bootstrap3/templates/Recommend/SideFacets.phtml @@ -47,8 +47,14 @@ <? if (isset($rangeFacets[$title])): ?> <?=$this->context($this)->renderInContext('Recommend/SideFacets/range-slider.phtml', ['title' => $title, 'facet' => $rangeFacets[$title]]); ?> <? else: ?> + <? $contextVars = [ + 'allowExclude' => $this->recommend->excludeAllowed($title), + 'title' => $title, + 'sortOptions' => isset($hierarchicalFacetSortOptions[$title]) ? $hierarchicalFacetSortOptions[$title] : '', + 'collapsedFacets' => $collapsedFacets + ]; ?> <? if (in_array($title, $hierarchicalFacets)): ?> - <?=$this->context($this)->renderInContext('Recommend/SideFacets/hierarchical-facet.phtml', ['title' => $title, 'sortOptions' => $hierarchicalFacetSortOptions[$title]]); ?> + <?=$this->context($this)->renderInContext('Recommend/SideFacets/hierarchical-facet.phtml', $contextVars); ?> <noscript> <? endif; ?> <? $contextVars = [ diff --git a/themes/bootstrap3/templates/Recommend/SideFacets/hierarchical-facet.phtml b/themes/bootstrap3/templates/Recommend/SideFacets/hierarchical-facet.phtml index 83c50e22aca..cf26f37cad7 100644 --- a/themes/bootstrap3/templates/Recommend/SideFacets/hierarchical-facet.phtml +++ b/themes/bootstrap3/templates/Recommend/SideFacets/hierarchical-facet.phtml @@ -1,5 +1,5 @@ <? $this->headScript()->appendFile('vendor/jsTree/jstree.min.js'); ?> -<? if (!in_array($this->title, $collapsedFacets)): ?> +<? if (!in_array($this->title, $this->collapsedFacets)): ?> <? $script = <<<JS $(document).ready(function() { @@ -21,7 +21,7 @@ JS; <li id="facet_<?=$this->escapeHtml($this->title)?>" class="jstree-facet" data-facet="<?=$this->escapeHtmlAttr($this->title)?>" data-path="<?=$this->currentPath()?>" - data-exclude="<?=$allowExclude?>" + data-exclude="<?=$this->allowExclude?>" data-operator="<?=$this->recommend->getFacetOperator($this->title)?>" data-exclude-title="<?=$this->transEsc('exclude_facet')?>" data-sort="<?=isset($this->sortOptions) ? $this->sortOptions : ''?>"> -- GitLab