From c0c4b27d61051c74b2e83bdde67b2fde9f8a79a5 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Tue, 16 Jul 2013 15:21:09 -0400 Subject: [PATCH] Fixed web search RSS feed. --- .../src/VuFind/View/Helper/Root/ResultFeed.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/module/VuFind/src/VuFind/View/Helper/Root/ResultFeed.php b/module/VuFind/src/VuFind/View/Helper/Root/ResultFeed.php index f12a9e50438..8548ad130dd 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/ResultFeed.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/ResultFeed.php @@ -149,7 +149,17 @@ class ResultFeed extends AbstractHelper $entry->setTitle(empty($title) ? $record->getBreadcrumb() : $title); $serverUrl = $this->getView()->plugin('serverurl'); $recordLink = $this->getView()->plugin('recordlink'); - $entry->setLink($serverUrl($recordLink->getUrl($record))); + try { + $url = $serverUrl($recordLink->getUrl($record)); + } catch (\Zend\Mvc\Router\Exception\RuntimeException $e) { + // No route defined? See if we can get a URL out of the driver. + // Useful for web results, among other things. + $url = $record->tryMethod('getUrl'); + if (empty($url) || !is_string($url)) { + throw new \Exception('Cannot find URL for record.'); + } + } + $entry->setLink($url); $date = $this->getDateModified($record); if (!empty($date)) { $entry->setDateModified($date); -- GitLab