diff --git a/module/VuFind/src/VuFind/View/Helper/Blueprint/Search.php b/module/VuFind/src/VuFind/View/Helper/Blueprint/Search.php index bccf117fd4d9ba2edb1d904700e31f29036a4bc0..e9d436a1cd5ea85e5d10f8b67ed19f725ca740a2 100644 --- a/module/VuFind/src/VuFind/View/Helper/Blueprint/Search.php +++ b/module/VuFind/src/VuFind/View/Helper/Blueprint/Search.php @@ -42,13 +42,16 @@ class Search extends AbstractHelper /** * Support function to display spelling suggestions. * - * @param string $msg HTML to display at the top of the spelling section. + * @param string $msg HTML to display at the top of + * the spelling section. + * @param \VuFind\Search\Base\Results $results Results object + * @param \Zend\View\Renderer\PhpRenderer $view View renderer object * * @return string */ - public function renderSpellingSuggestions($msg) + public function renderSpellingSuggestions($msg, $results, $view) { - $spellingSuggestions = $this->view->results->getSpellingSuggestions(); + $spellingSuggestions = $results->getSpellingSuggestions(); if (empty($spellingSuggestions)) { return ''; } @@ -56,22 +59,22 @@ class Search extends AbstractHelper $html = '<div class="corrections">'; $html .= $msg; foreach ($spellingSuggestions as $term => $details) { - $html .= '<br/>' . $this->view->escapeHtml($term) . ' » '; + $html .= '<br/>' . $view->escapeHtml($term) . ' » '; $i = 0; foreach ($details['suggestions'] as $word => $data) { if ($i++ > 0) { $html .= ', '; } $html .= '<a href="' - . $this->view->results->getUrlQuery() + . $view->results->getUrlQuery() ->replaceTerm($term, $data['new_term']) - . '">' . $this->view->escapeHtml($word) . '</a>'; + . '">' . $view->escapeHtml($word) . '</a>'; if (isset($data['expand_term']) && !empty($data['expand_term'])) { $html .= '<a href="' - . $this->view->results->getUrlQuery() + . $results->getUrlQuery() ->replaceTerm($term, $data['expand_term']) - . '"><img src="' . $this->view->imageLink('silk/expand.png') - . '" alt="' . $this->view->transEsc('spell_expand_alt') + . '"><img src="' . $view->imageLink('silk/expand.png') + . '" alt="' . $view->transEsc('spell_expand_alt') . '"/></a>'; } } diff --git a/themes/blueprint/templates/search/results.phtml b/themes/blueprint/templates/search/results.phtml index 4fdc544f4180329c7f6197d0ad8cef379be83c22..5db2662f51af4247235453a72fa2407cfcf302e2 100644 --- a/themes/blueprint/templates/search/results.phtml +++ b/themes/blueprint/templates/search/results.phtml @@ -57,7 +57,7 @@ <? if ($qtime = $this->results->getQuerySpeed()): ?> <?=$this->transEsc('query time')?>: <?=$this->escapeHtml(round($qtime, 2))?>s <? endif; ?> - <?=$this->search()->renderSpellingSuggestions('<strong>' . $this->transEsc('spell_suggest') . '</strong>:'); ?> + <?=$this->search()->renderSpellingSuggestions('<strong>' . $this->transEsc('spell_suggest') . '</strong>:', $this->results, $this); ?> <? else: ?> <h3><?=$this->transEsc('nohit_heading')?></h3> <? endif; ?> @@ -85,7 +85,7 @@ <? if (isset($this->parseError)): ?> <p class="error"><?=$this->transEsc('nohit_parse_error')?></p> <? endif; ?> - <?=$this->search()->renderSpellingSuggestions($this->transEsc('nohit_spelling') . ':'); ?> + <?=$this->search()->renderSpellingSuggestions($this->transEsc('nohit_spelling') . ':', $this->results, $this); ?> <? foreach ($this->results->getRecommendations('top') as $current): ?> <?=$this->recommend($current)?> <? endforeach; ?>