From 75afc6357e97f0a03701d0b124d0e6d381c46bc2 Mon Sep 17 00:00:00 2001 From: Ere Maijala <ere.maijala@helsinki.fi> Date: Thu, 28 May 2015 14:01:29 +0300 Subject: [PATCH] Improved the flexibility of OpenURL creation by making it possible to add new OpenURL formats. --- .../src/VuFind/RecordDriver/SolrDefault.php | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/module/VuFind/src/VuFind/RecordDriver/SolrDefault.php b/module/VuFind/src/VuFind/RecordDriver/SolrDefault.php index 3f7120c9133..873be5d80b9 100644 --- a/module/VuFind/src/VuFind/RecordDriver/SolrDefault.php +++ b/module/VuFind/src/VuFind/RecordDriver/SolrDefault.php @@ -860,19 +860,12 @@ class SolrDefault extends AbstractBase public function getOpenURL() { // Set up parameters based on the format of the record: - switch ($format = $this->getOpenURLFormat()) { - case 'Book': - $params = $this->getBookOpenURLParams(); - break; - case 'Article': - $params = $this->getArticleOpenURLParams(); - break; - case 'Journal': - $params = $this->getJournalOpenURLParams(); - break; - default: + $format = $this->getOpenURLFormat(); + $method = "get{$format}OpenURLParams"; + if (method_exists($this, $method)) { + $params = $this->$method(); + } else { $params = $this->getUnknownFormatOpenURLParams($format); - break; } // Assemble the URL: -- GitLab