From 6a3c3456d2f46ff53128e4755793b2050ad7137c Mon Sep 17 00:00:00 2001
From: Robert Lange <robert.lange@uni-leipzig.de>
Date: Mon, 14 Dec 2020 16:37:02 +0100
Subject: [PATCH] refs #18780 [fid_adlr] fix multiple titles

* remove duplicates
* use \Zend\View\Helper\Placeholder\Container\AbstractContainer::SET to overwrite title instead of append
---
 themes/fid_adlr/templates/RecordTab/acquisitionpda.phtml | 2 --
 themes/fid_adlr/templates/RecordTab/description.phtml    | 3 ---
 themes/fid_adlr/templates/RecordTab/holdingsils.phtml    | 2 --
 themes/fid_adlr/templates/RecordTab/staffviewai.phtml    | 2 --
 themes/fid_adlr/templates/RecordTab/staffviewmarc.phtml  | 2 --
 themes/fid_adlr/templates/RecordTab/toc.phtml            | 3 ---
 themes/fid_adlr/templates/layout/layout.phtml            | 7 +------
 themes/fid_adlr/templates/record/view.phtml              | 1 +
 themes/fid_adlr/templates/search/results.phtml           | 3 +--
 9 files changed, 3 insertions(+), 22 deletions(-)

diff --git a/themes/fid_adlr/templates/RecordTab/acquisitionpda.phtml b/themes/fid_adlr/templates/RecordTab/acquisitionpda.phtml
index 402670746fc..59953f0c5d7 100644
--- a/themes/fid_adlr/templates/RecordTab/acquisitionpda.phtml
+++ b/themes/fid_adlr/templates/RecordTab/acquisitionpda.phtml
@@ -30,8 +30,6 @@ if (!$offlineMode) {
         $offlineMode = 'ils-offline';
     }
 }
-// Set page title.
-$this->headTitle($this->driver->getBreadcrumb());
 
 $isRecordOrdered = $this->getit($this->driver)->isRecordOrdered();
 ?>
diff --git a/themes/fid_adlr/templates/RecordTab/description.phtml b/themes/fid_adlr/templates/RecordTab/description.phtml
index 54df32f043f..fa76c68d88c 100644
--- a/themes/fid_adlr/templates/RecordTab/description.phtml
+++ b/themes/fid_adlr/templates/RecordTab/description.phtml
@@ -1,8 +1,5 @@
 <!-- fid_adlr: recordtab - description -->
 <?php
-// Set page title.
-$this->headTitle($this->driver->getBreadcrumb());
-
 $formatter = $this->recordDataFormatter();
 $mainFields = $formatter->getData($this->driver, $formatter->getDefaults('description'));
 ?>
diff --git a/themes/fid_adlr/templates/RecordTab/holdingsils.phtml b/themes/fid_adlr/templates/RecordTab/holdingsils.phtml
index b7983c30fa6..fe522c6c682 100644
--- a/themes/fid_adlr/templates/RecordTab/holdingsils.phtml
+++ b/themes/fid_adlr/templates/RecordTab/holdingsils.phtml
@@ -31,8 +31,6 @@
       $offlineMode = 'ils-offline';
     }
   }
-  // Set page title.
-  $this->headTitle($this->driver->getBreadcrumb());
 ?>
 
 <?php if ($user && $getitConfig['bossData']): ?>
diff --git a/themes/fid_adlr/templates/RecordTab/staffviewai.phtml b/themes/fid_adlr/templates/RecordTab/staffviewai.phtml
index 709b245524f..b0f10f828cb 100644
--- a/themes/fid_adlr/templates/RecordTab/staffviewai.phtml
+++ b/themes/fid_adlr/templates/RecordTab/staffviewai.phtml
@@ -1,7 +1,5 @@
 <!-- fid_adlr: recordtab - staffviewai -->
 <?php
-// Set page title.
-$this->headTitle($this->driver->getBreadcrumb());
 ?>
 <table class="citation table table-striped">
   <?php foreach ($this->driver->getAIRecord() as $field => $values): ?>
diff --git a/themes/fid_adlr/templates/RecordTab/staffviewmarc.phtml b/themes/fid_adlr/templates/RecordTab/staffviewmarc.phtml
index 54af3f791ea..8f001a9dce0 100644
--- a/themes/fid_adlr/templates/RecordTab/staffviewmarc.phtml
+++ b/themes/fid_adlr/templates/RecordTab/staffviewmarc.phtml
@@ -1,7 +1,5 @@
 <!-- fid_adlr: recordtab - staffviewmarc -->
 <?php
-// Set page title.
-$this->headTitle($this->driver->getBreadcrumb());
 ?>
 <?=\VuFind\XSLT\Processor::process('record-marc.xsl', $this->driver->getXML('marc21'))?>
 <?php /* the following introduced in 9934*/ ?>
diff --git a/themes/fid_adlr/templates/RecordTab/toc.phtml b/themes/fid_adlr/templates/RecordTab/toc.phtml
index 0925ed435f3..5b4c5b7aa81 100644
--- a/themes/fid_adlr/templates/RecordTab/toc.phtml
+++ b/themes/fid_adlr/templates/RecordTab/toc.phtml
@@ -1,8 +1,5 @@
 <!-- fid_adlr: recordtab - toc -->
 <?php
-// Set page title.
-$this->headTitle($this->driver->getBreadcrumb());
-
 $formatter = $this->recordDataFormatter();
 $mainFields = $formatter->getData($this->driver, $formatter->getDefaults('toc'));
 ?>
diff --git a/themes/fid_adlr/templates/layout/layout.phtml b/themes/fid_adlr/templates/layout/layout.phtml
index 4c23209b783..ea23889fc6c 100644
--- a/themes/fid_adlr/templates/layout/layout.phtml
+++ b/themes/fid_adlr/templates/layout/layout.phtml
@@ -4,11 +4,6 @@
   <?php $this->headThemeResources(); ?>
   <?php /* remove meta because of W3C Validator error - CK */
   /*  <meta charset="utf-8">  */
-
-  if (empty($this->headTitle()) || $this->headTitle()->toString() == "<title></title>") {
-    $this->headTitle($this->translate('adlr_head_title'));
-  }
-
   ?>
   <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
   <meta name="viewport" content="width=device-width,initial-scale=1.0"/>
@@ -20,7 +15,7 @@
   <? /* END TODO */ ?>
 
   <?=$this->headMeta()?>
-  <?=$this->headTitle()?>
+  <?=$this->headTitle(' ' . $this->translate('adlr_head_title'))?>
   <?php
   // Set up OpenSearch link:
   $this->headLink(
diff --git a/themes/fid_adlr/templates/record/view.phtml b/themes/fid_adlr/templates/record/view.phtml
index c669e697c84..ab1f790e1e3 100644
--- a/themes/fid_adlr/templates/record/view.phtml
+++ b/themes/fid_adlr/templates/record/view.phtml
@@ -18,6 +18,7 @@ if ($this->export()->recordSupportsFormat($this->driver, 'RDF')) {
 $this->layout()->breadcrumbs = '<li>' . $this->searchMemory()->getLastSearchLink($this->transEsc('Search'), '', '</li> ') .
   '<li class="active">' . $this->recordLink()->getBreadcrumb($this->driver) . '</li> ';
 $this->layout()->title = $this->driver->getShortTitle();
+$this->headTitle($this->driver->getBreadcrumb() . ' -');
 ?>
 
 <?php /* fid_adlr:Remove previous and next record refs #15650 - GG */ ?>
diff --git a/themes/fid_adlr/templates/search/results.phtml b/themes/fid_adlr/templates/search/results.phtml
index 267ac43e055..c07ca923112 100644
--- a/themes/fid_adlr/templates/search/results.phtml
+++ b/themes/fid_adlr/templates/search/results.phtml
@@ -1,9 +1,8 @@
 <!-- fid_adlr: search - results -->
 <?php
-// Set up page title:
-$this->headTitle($this->translate('adlr_head_title'));
 
 $lookfor = $this->results->getUrlQuery()->isQuerySuppressed() ? '' : $this->params->getDisplayQuery();
+$this->headTitle($this->translate('Search Results') . (empty($lookfor) ? '' : " - {$lookfor} - "));
 
 // Set up search box:
 $this->layout()->searchbox = $this->context($this)->renderInContext(
-- 
GitLab