From a994039e62df7405e01dd2d212faab90d9504b03 Mon Sep 17 00:00:00 2001
From: Josef Moravec <josef.moravec@gmail.com>
Date: Thu, 7 Nov 2019 14:34:30 +0100
Subject: [PATCH] Enable DOI linker in EDS records (#1493)

---
 module/VuFind/src/VuFind/RecordDriver/EDS.php   | 17 +++++++++++++++++
 .../templates/RecordDriver/EDS/core.phtml       |  4 ++++
 .../RecordDriver/EDS/result-list.phtml          |  5 +++++
 3 files changed, 26 insertions(+)

diff --git a/module/VuFind/src/VuFind/RecordDriver/EDS.php b/module/VuFind/src/VuFind/RecordDriver/EDS.php
index bd3b2e9a7b0..208260ea92c 100644
--- a/module/VuFind/src/VuFind/RecordDriver/EDS.php
+++ b/module/VuFind/src/VuFind/RecordDriver/EDS.php
@@ -569,4 +569,21 @@ class EDS extends DefaultRecord
         // EDS is not export-friendly; disable all formats.
         return true;
     }
+
+    /**
+     * Return the first valid DOI found in the record (false if none).
+     *
+     * @return mixed
+     */
+    public function getCleanDOI()
+    {
+        if (isset($this->fields['Items'])) {
+            foreach ($this->fields['Items'] as $item) {
+                if ('DOI' == $item['Name']) {
+                    return $item['Data'];
+                }
+            }
+        }
+        return false;
+    }
 }
diff --git a/themes/bootstrap3/templates/RecordDriver/EDS/core.phtml b/themes/bootstrap3/templates/RecordDriver/EDS/core.phtml
index 09046f592ab..4297ed52482 100644
--- a/themes/bootstrap3/templates/RecordDriver/EDS/core.phtml
+++ b/themes/bootstrap3/templates/RecordDriver/EDS/core.phtml
@@ -105,6 +105,10 @@
         </span>
       <?php endforeach; ?>
     <?php endif; ?>
+
+    <?php $doi = $this->doi($this->driver, 'record'); if ($doi->isActive()): ?>
+        <div><?=$doi->renderTemplate()?></div>
+    <?php endif; ?>
     </div>
   </div>
 </div>
diff --git a/themes/bootstrap3/templates/RecordDriver/EDS/result-list.phtml b/themes/bootstrap3/templates/RecordDriver/EDS/result-list.phtml
index 1328784fbf4..d42c646c30f 100644
--- a/themes/bootstrap3/templates/RecordDriver/EDS/result-list.phtml
+++ b/themes/bootstrap3/templates/RecordDriver/EDS/result-list.phtml
@@ -88,6 +88,11 @@
           <?=$this->transEsc('PDF Full Text')?>
         </a>
       <?php endif; ?>
+
+      <?php /* Links from DOI linker */ ?>
+      <?php $doi = $this->doi($this->driver, 'results'); if ($doi->isActive()):?>
+        <?=$doi->renderTemplate()?>
+      <?php endif; ?>
     </div>
     <div class="result-links hidden-print">
       <?php /* Display qrcode if appropriate: */ ?>
-- 
GitLab