From 967723deaa08282e9bd0e198937bc63031fb2874 Mon Sep 17 00:00:00 2001
From: Ere Maijala <ere.maijala@helsinki.fi>
Date: Wed, 7 Jun 2017 13:42:42 -0400
Subject: [PATCH] Improved view control display. - Fixes view.phtml to display
 the translated name for the view in title and display the title for selected
 view also when hovering over the text part.

---
 .../templates/search/controls/view.phtml          | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/themes/bootstrap3/templates/search/controls/view.phtml b/themes/bootstrap3/templates/search/controls/view.phtml
index be6f623aa84..0d8fef0da6b 100644
--- a/themes/bootstrap3/templates/search/controls/view.phtml
+++ b/themes/bootstrap3/templates/search/controls/view.phtml
@@ -1,11 +1,20 @@
 <div class="view-buttons hidden-xs">
   <? $viewList = $this->params->getViewList(); if (count($viewList) > 1): ?>
     <? foreach ($viewList as $viewType => $viewData): ?>
+      <? $viewDesc = $this->translate($viewData['desc']); ?>
       <? if (!$viewData['selected']): ?>
-        <a href="<?=$this->results->getUrlQuery()->setViewParam($viewType)?>" title="<?=$this->transEsc('switch_view', ['%%view%%' => $viewData['desc']])?>" >
+        <a href="<?=$this->results->getUrlQuery()->setViewParam($viewType)?>" title="<?=$this->escapeHtmlAttr($this->translate('switch_view', ['%%view%%' => $viewDesc]))?>" >
+      <? else: ?>
+        <span title="<?=$this->escapeHtmlAttr($this->translate('view_already_selected', ['%%current%%' => $viewDesc])) ?>">
       <? endif; ?>
-      <i class="fa fa-<?=$viewType ?>"<? if($viewData['selected']): ?> title="<?=$this->transEsc('view_already_selected', ['%%current%%' => $viewData['desc']]) ?>"<? endif ?> alt="<?=$this->transEsc($viewData['desc'])?>"></i>
-      <?=$this->transEsc($viewData['desc']) ?><? if (!$viewData['selected']): ?></a><? endif; ?>&nbsp;
+      <i class="fa fa-<?=$viewType ?>" alt="<?=$this->escapeHtmlAttr($viewDesc)?>"></i>
+      <?=$viewDesc ?>
+      <? if (!$viewData['selected']): ?>
+        </a>
+      <? else: ?>
+        </span>
+      <? endif; ?>
+      &nbsp;
     <? endforeach; ?>
   <? endif; ?>
 </div>
-- 
GitLab