diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Record.php b/module/VuFind/src/VuFind/View/Helper/Root/Record.php index 5c7e38fd525284414b004245ee752ad18d321c90..a23448a4ad1a1461a4cdbe6c50ecafaa92fbdae4 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/Record.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/Record.php @@ -553,13 +553,15 @@ class Record extends AbstractHelper * Get all the links associated with this record. Returns an array of * associative arrays each containing 'desc' and 'url' keys. * + * @param bool $openUrlActive Is there an active OpenURL on the page? + * * @return array */ - public function getLinkDetails() + public function getLinkDetails($openUrlActive = false) { // See if there are any links available: $urls = $this->driver->tryMethod('getURLs'); - if (empty($urls)) { + if (empty($urls) || ($openUrlActive && $this->hasOpenUrlReplaceSetting())) { return []; } @@ -606,15 +608,11 @@ class Record extends AbstractHelper * replace_other_urls. Returns an array of associative arrays each containing * 'desc' and 'url' keys. * - * @return array + * @return bool */ - public function getLinkDetailsForOpenUrl() + protected function hasOpenUrlReplaceSetting() { - if (isset($this->config->OpenURL->replace_other_urls) - && $this->config->OpenURL->replace_other_urls - ) { - return []; - } - return $this->getLinkDetails(); + return isset($this->config->OpenURL->replace_other_urls) + && $this->config->OpenURL->replace_other_urls; } } diff --git a/themes/blueprint/templates/RecordDriver/Pazpar2/result-list.phtml b/themes/blueprint/templates/RecordDriver/Pazpar2/result-list.phtml index 4eb2ae0646b0863563677bbf6c9ebd0421ecf1ad..662baa3a6387d02970b02b7646853bc3abfc2141 100644 --- a/themes/blueprint/templates/RecordDriver/Pazpar2/result-list.phtml +++ b/themes/blueprint/templates/RecordDriver/Pazpar2/result-list.phtml @@ -63,7 +63,7 @@ $openUrl = $this->openUrl($this->driver, 'results'); $openUrlActive = $openUrl->isActive(); // Account for replace_other_urls setting - $urls = $openUrlActive ? $this->record($this->driver)->getLinkDetailsForOpenUrl() : $this->record($this->driver)->getLinkDetails() ; + $urls = $this->record($this->driver)->getLinkDetails($openUrlActive); if ($openUrlActive || !empty($urls)): ?> <? if ($openUrlActive): ?> <br/> diff --git a/themes/blueprint/templates/RecordDriver/SolrDefault/collection-info.phtml b/themes/blueprint/templates/RecordDriver/SolrDefault/collection-info.phtml index 46de8dde9373f619f919e3cc0fe5ca4672aaf88c..1bc6a3cbf1ca83d3fd4ece41082a5c28340350e2 100644 --- a/themes/blueprint/templates/RecordDriver/SolrDefault/collection-info.phtml +++ b/themes/blueprint/templates/RecordDriver/SolrDefault/collection-info.phtml @@ -133,7 +133,7 @@ $openUrl = $this->openUrl($this->driver, 'record'); $openUrlActive = $openUrl->isActive(); // Account for replace_other_urls setting - $urls = $openUrlActive ? $this->record($this->driver)->getLinkDetailsForOpenUrl() : $this->record($this->driver)->getLinkDetails() ; + $urls = $this->record($this->driver)->getLinkDetails($openUrlActive); ?> <? if (!empty($urls) || $openUrlActive): ?> <tr valign="top"> diff --git a/themes/blueprint/templates/RecordDriver/SolrDefault/core.phtml b/themes/blueprint/templates/RecordDriver/SolrDefault/core.phtml index 2349e0a1961821f66916194bdd06bfe1e2bef956..05ef8428f7bf30d4a18d7b6b0122ef9ac1bcc0ed 100644 --- a/themes/blueprint/templates/RecordDriver/SolrDefault/core.phtml +++ b/themes/blueprint/templates/RecordDriver/SolrDefault/core.phtml @@ -174,7 +174,7 @@ $openUrl = $this->openUrl($this->driver, 'record'); $openUrlActive = $openUrl->isActive(); // Account for replace_other_urls setting - $urls = $openUrlActive ? $this->record($this->driver)->getLinkDetailsForOpenUrl() : $this->record($this->driver)->getLinkDetails() ; + $urls = $this->record($this->driver)->getLinkDetails($openUrlActive); ?> <? if (!empty($urls) || $openUrlActive): ?> <tr valign="top"> diff --git a/themes/blueprint/templates/RecordDriver/SolrDefault/list-entry.phtml b/themes/blueprint/templates/RecordDriver/SolrDefault/list-entry.phtml index 4053efdf3e91abd30ed606ca3eda525793adb4d4..1470c1b975f046660aa87a3050cc291c059cac17 100644 --- a/themes/blueprint/templates/RecordDriver/SolrDefault/list-entry.phtml +++ b/themes/blueprint/templates/RecordDriver/SolrDefault/list-entry.phtml @@ -79,7 +79,7 @@ $openUrl = $this->openUrl($this->driver, 'results'); $openUrlActive = $openUrl->isActive(); // Account for replace_other_urls setting - $urls = $openUrlActive ? $this->record($this->driver)->getLinkDetailsForOpenUrl() : $this->record($this->driver)->getLinkDetails() ; + $urls = $this->record($this->driver)->getLinkDetails($openUrlActive); if ($openUrlActive || !empty($urls)): ?> <? if ($openUrlActive): ?> <br/> diff --git a/themes/blueprint/templates/RecordDriver/SolrDefault/result-grid.phtml b/themes/blueprint/templates/RecordDriver/SolrDefault/result-grid.phtml index 6489a5e744edcf20271bd8db618de619220ccee5..7a46f3e4327528dacd939fd6a1a2c72266d82398 100644 --- a/themes/blueprint/templates/RecordDriver/SolrDefault/result-grid.phtml +++ b/themes/blueprint/templates/RecordDriver/SolrDefault/result-grid.phtml @@ -7,7 +7,7 @@ <a class="gridTitle" href="<?=$this->recordLink()->getUrl($this->driver)?>"> <?=$this->record($this->driver)->getTitleHtml(80)?> </a> - <? + <? /* We need to find out if we're supposed to display an OpenURL link ($openUrlActive), but even if we don't plan to display the link, we still want to get the $openUrl value for use in generating a COinS (Z3988) tag -- see bottom of file. @@ -15,9 +15,9 @@ $openUrl = $this->openUrl($this->driver, 'results'); $openUrlActive = $openUrl->isActive(); // Account for replace_other_urls setting - $urls = $openUrlActive ? $this->record($this->driver)->getLinkDetailsForOpenUrl() : $this->record($this->driver)->getLinkDetails() ; - ?> - if ($openUrlActive || !empty($urls)): ?> + $urls = $this->record($this->driver)->getLinkDetails($openUrlActive); + ?> + <? if ($openUrlActive || !empty($urls)): ?> <? if ($openUrlActive): ?> <?=$openUrl->renderTemplate()?><br /> <? endif; ?> diff --git a/themes/blueprint/templates/RecordDriver/SolrDefault/result-list.phtml b/themes/blueprint/templates/RecordDriver/SolrDefault/result-list.phtml index d98ba4a07ef88d1c0b22455e3d516c2b49a9cb34..1093ea38401a08f5fe378b978d7befe0078decf0 100644 --- a/themes/blueprint/templates/RecordDriver/SolrDefault/result-list.phtml +++ b/themes/blueprint/templates/RecordDriver/SolrDefault/result-list.phtml @@ -112,7 +112,7 @@ $openUrl = $this->openUrl($this->driver, 'results'); $openUrlActive = $openUrl->isActive(); // Account for replace_other_urls setting - $urls = $openUrlActive ? $this->record($this->driver)->getLinkDetailsForOpenUrl() : $this->record($this->driver)->getLinkDetails() ; + $urls = $this->record($this->driver)->getLinkDetails($openUrlActive); if ($openUrlActive || !empty($urls)): ?> <? if ($openUrlActive): ?> <br/> diff --git a/themes/blueprint/templates/RecordTab/holdingsils.phtml b/themes/blueprint/templates/RecordTab/holdingsils.phtml index 308cef8b6ae1b960d11e19d6471e79cc3bbe5c1c..c31352f85916dac7973ecf19d5cab60e2b1721c8 100644 --- a/themes/blueprint/templates/RecordTab/holdingsils.phtml +++ b/themes/blueprint/templates/RecordTab/holdingsils.phtml @@ -6,7 +6,7 @@ $openUrl = $this->openUrl($this->driver, 'holdings'); $openUrlActive = $openUrl->isActive(); // Account for replace_other_urls setting - $urls = $openUrlActive ? $this->record($this->driver)->getLinkDetailsForOpenUrl() : $this->record($this->driver)->getLinkDetails() ; + $urls = $this->record($this->driver)->getLinkDetails($openUrlActive); $offlineMode = $this->ils()->getOfflineMode(); // Set page title. $this->headTitle($this->translate('Holdings') . ': ' . $this->driver->getBreadcrumb()); diff --git a/themes/bootstrap3/templates/RecordDriver/Pazpar2/result-list.phtml b/themes/bootstrap3/templates/RecordDriver/Pazpar2/result-list.phtml index a13a6df866964b2766ab86c5ad6e5d420605bf60..20d68bc04ea2ae445e007c7fa25d4c72b32f273e 100644 --- a/themes/bootstrap3/templates/RecordDriver/Pazpar2/result-list.phtml +++ b/themes/bootstrap3/templates/RecordDriver/Pazpar2/result-list.phtml @@ -78,7 +78,7 @@ $openUrl = $this->openUrl($this->driver, 'results'); $openUrlActive = $openUrl->isActive(); // Account for replace_other_urls setting - $urls = $openUrlActive ? $this->record($this->driver)->getLinkDetailsForOpenUrl() : $this->record($this->driver)->getLinkDetails() ; + $urls = $this->record($this->driver)->getLinkDetails($openUrlActive); if ($openUrlActive || !empty($urls)): ?> <? if ($openUrlActive): ?> <br/> diff --git a/themes/bootstrap3/templates/RecordDriver/SolrDefault/collection-info.phtml b/themes/bootstrap3/templates/RecordDriver/SolrDefault/collection-info.phtml index 183f94290fe2699e774e41590ffa63595aab5f10..f1a2b1cf134ba02e3fda394b4054f1cc7331b9b3 100644 --- a/themes/bootstrap3/templates/RecordDriver/SolrDefault/collection-info.phtml +++ b/themes/bootstrap3/templates/RecordDriver/SolrDefault/collection-info.phtml @@ -156,7 +156,7 @@ $openUrl = $this->openUrl($this->driver, 'record'); $openUrlActive = $openUrl->isActive(); // Account for replace_other_urls setting - $urls = $openUrlActive ? $this->record($this->driver)->getLinkDetailsForOpenUrl() : $this->record($this->driver)->getLinkDetails() ; + $urls = $this->record($this->driver)->getLinkDetails($openUrlActive); ?> <? if (!empty($urls) || $openUrlActive): ?> <tr> diff --git a/themes/bootstrap3/templates/RecordDriver/SolrDefault/core.phtml b/themes/bootstrap3/templates/RecordDriver/SolrDefault/core.phtml index 660a2660bb22e90a335578d32162c16159c7ee12..1899f543a9a24577402db0efe4daf84816494f8f 100644 --- a/themes/bootstrap3/templates/RecordDriver/SolrDefault/core.phtml +++ b/themes/bootstrap3/templates/RecordDriver/SolrDefault/core.phtml @@ -216,7 +216,7 @@ $openUrl = $this->openUrl($this->driver, 'record'); $openUrlActive = $openUrl->isActive(); // Account for replace_other_urls setting - $urls = $openUrlActive ? $this->record($this->driver)->getLinkDetailsForOpenUrl() : $this->record($this->driver)->getLinkDetails() ; + $urls = $this->record($this->driver)->getLinkDetails($openUrlActive); ?> <? if (!empty($urls) || $openUrlActive): ?> <tr> diff --git a/themes/bootstrap3/templates/RecordDriver/SolrDefault/list-entry.phtml b/themes/bootstrap3/templates/RecordDriver/SolrDefault/list-entry.phtml index c926d365746ccb9864b6adac136d1b2b47fc9a88..ab08acbfccf0c7c2fe9237ce2969c64a0adc19a8 100644 --- a/themes/bootstrap3/templates/RecordDriver/SolrDefault/list-entry.phtml +++ b/themes/bootstrap3/templates/RecordDriver/SolrDefault/list-entry.phtml @@ -130,7 +130,7 @@ $openUrl = $this->openUrl($this->driver, 'results'); $openUrlActive = $openUrl->isActive(); // Account for replace_other_urls setting - $urls = $openUrlActive ? $this->record($this->driver)->getLinkDetailsForOpenUrl() : $this->record($this->driver)->getLinkDetails() ; + $urls = $this->record($this->driver)->getLinkDetails($openUrlActive); if ($openUrlActive || !empty($urls)): ?> diff --git a/themes/bootstrap3/templates/RecordDriver/SolrDefault/result-grid.phtml b/themes/bootstrap3/templates/RecordDriver/SolrDefault/result-grid.phtml index c516921fc197ad0f21bd27a70d1f006cccdec36a..bfe3c8e7e281f06b92f46867fcf1ede0b06215cd 100644 --- a/themes/bootstrap3/templates/RecordDriver/SolrDefault/result-grid.phtml +++ b/themes/bootstrap3/templates/RecordDriver/SolrDefault/result-grid.phtml @@ -6,7 +6,7 @@ $openUrl = $this->openUrl($this->driver, 'results'); $openUrlActive = $openUrl->isActive(); // Account for replace_other_urls setting -$urls = $openUrlActive ? $this->record($this->driver)->getLinkDetailsForOpenUrl() : $this->record($this->driver)->getLinkDetails() ; +$urls = $this->record($this->driver)->getLinkDetails($openUrlActive); ?> <div class="result <?=$this->driver->supportsAjaxStatus()?' ajaxItem':''?>"> diff --git a/themes/bootstrap3/templates/RecordDriver/SolrDefault/result-list.phtml b/themes/bootstrap3/templates/RecordDriver/SolrDefault/result-list.phtml index a5e48e71379acfa726d6a8b9a2cbb94bdf70a308..6c68093317cf7ef9e0b8b9b07b87b0c8000e4100 100644 --- a/themes/bootstrap3/templates/RecordDriver/SolrDefault/result-list.phtml +++ b/themes/bootstrap3/templates/RecordDriver/SolrDefault/result-list.phtml @@ -119,7 +119,7 @@ $openUrl = $this->openUrl($this->driver, 'results'); $openUrlActive = $openUrl->isActive(); // Account for replace_other_urls setting - $urls = $openUrlActive ? $this->record($this->driver)->getLinkDetailsForOpenUrl() : $this->record($this->driver)->getLinkDetails() ; + $urls = $this->record($this->driver)->getLinkDetails($openUrlActive); if ($openUrlActive || !empty($urls)): ?> <? if ($openUrlActive): ?> diff --git a/themes/bootstrap3/templates/RecordTab/holdingsils.phtml b/themes/bootstrap3/templates/RecordTab/holdingsils.phtml index c81a4e2989c87e47863ed9771a39bb9ae3301395..6839e36a28536f1ffaddc83617006903be3a27ed 100644 --- a/themes/bootstrap3/templates/RecordTab/holdingsils.phtml +++ b/themes/bootstrap3/templates/RecordTab/holdingsils.phtml @@ -6,7 +6,7 @@ $openUrl = $this->openUrl($this->driver, 'holdings'); $openUrlActive = $openUrl->isActive(); // Account for replace_other_urls setting - $urls = $openUrlActive ? $this->record($this->driver)->getLinkDetailsForOpenUrl() : $this->record($this->driver)->getLinkDetails() ; + $urls = $this->record($this->driver)->getLinkDetails($openUrlActive); $offlineMode = $this->ils()->getOfflineMode(); // Set page title. $this->headTitle($this->translate('Holdings') . ': ' . $this->driver->getBreadcrumb()); diff --git a/themes/jquerymobile/templates/RecordDriver/SolrDefault/core.phtml b/themes/jquerymobile/templates/RecordDriver/SolrDefault/core.phtml index 6ad6bba3a0cbd81f4c9aeefb18bcf12a265cda82..5541d5b77e877984c348a48953a5998cd05570c2 100644 --- a/themes/jquerymobile/templates/RecordDriver/SolrDefault/core.phtml +++ b/themes/jquerymobile/templates/RecordDriver/SolrDefault/core.phtml @@ -136,9 +136,7 @@ $openUrl = $this->openUrl($this->driver, 'record'); $openUrlActive = $openUrl->isActive(); // Account for replace_other_urls setting - $urls = $openUrlActive - ? $this->record($this->driver)->getLinkDetailsForOpenUrl() - : $this->record($this->driver)->getLinkDetails(); + $urls = $this->record($this->driver)->getLinkDetails($openUrlActive); ?> <? if (!empty($urls) || $openUrlActive): ?> <dt><?=$this->transEsc('Online Access')?>: </dt> diff --git a/themes/jquerymobile/templates/RecordDriver/SolrDefault/result-list.phtml b/themes/jquerymobile/templates/RecordDriver/SolrDefault/result-list.phtml index 0d44917101a97757dda0c6462fc5c05c4fb0bb18..18d9710016bd0c6585f54168635a1eaa29b7e74e 100644 --- a/themes/jquerymobile/templates/RecordDriver/SolrDefault/result-list.phtml +++ b/themes/jquerymobile/templates/RecordDriver/SolrDefault/result-list.phtml @@ -26,9 +26,7 @@ <? $openUrl = $this->openUrl($this->driver, 'results'); $openUrlActive = $openUrl->isActive(); - $urls = $openUrlActive - ? $this->record($this->driver)->getLinkDetailsForOpenUrl() - : $this->record($this->driver)->getLinkDetails(); + $urls = $this->record($this->driver)->getLinkDetails($openUrlActive); ?> <? if (!$openUrlActive && empty($urls) && $this->driver->supportsAjaxStatus()): ?> <p><span class="ajax_availability hide status"><?=$this->transEsc('Loading')?>...</span></p>