From ac0c939511e1a7fd138d25e1955f822253382cb3 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Thu, 14 Jun 2018 15:35:19 -0400 Subject: [PATCH] Avoid hard-coded routes in default link templates. --- .../templates/RecordDriver/DefaultRecord/link-author.phtml | 7 ++++++- .../RecordDriver/DefaultRecord/link-journaltitle.phtml | 3 ++- .../templates/RecordDriver/DefaultRecord/link-series.phtml | 3 ++- .../RecordDriver/DefaultRecord/link-subject.phtml | 3 ++- .../templates/RecordDriver/DefaultRecord/link-title.phtml | 3 ++- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-author.phtml b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-author.phtml index fdd7fe966a2..de7d0c87204 100644 --- a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-author.phtml +++ b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-author.phtml @@ -1 +1,6 @@ -<?=$this->url('author-home')?>?author=<?=urlencode($this->lookfor)?> +<?php $searchRoute = $this->searchOptions($this->driver->getSourceIdentifier())->getSearchAction(); ?> +<?php if ($searchRoute === 'search-results'): // override search-results with author module ?> + <?=$this->url('author-home')?>?author=<?=urlencode($this->lookfor)?> +<?php else: ?> + <?=$this->url($searchRoute)?>?lookfor=%22<?=urlencode($this->lookfor)?>%22&type=Author +<?php endif; ?> diff --git a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-journaltitle.phtml b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-journaltitle.phtml index 154b38cbbb1..d238071508c 100644 --- a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-journaltitle.phtml +++ b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-journaltitle.phtml @@ -1 +1,2 @@ -<?=$this->url('search-results')?>?lookfor=%22<?=urlencode($this->lookfor)?>%22&type=JournalTitle +<?php $searchRoute = $this->searchOptions($this->driver->getSourceIdentifier())->getSearchAction(); ?> +<?=$this->url($searchRoute)?>?lookfor=%22<?=urlencode($this->lookfor)?>%22&type=JournalTitle diff --git a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-series.phtml b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-series.phtml index 3b0406eeff7..f9aefd443a7 100644 --- a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-series.phtml +++ b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-series.phtml @@ -1 +1,2 @@ -<?=$this->url('search-results')?>?lookfor=%22<?=urlencode($this->lookfor)?>%22&type=Series +<?php $searchRoute = $this->searchOptions($this->driver->getSourceIdentifier())->getSearchAction(); ?> +<?=$this->url($searchRoute)?>?lookfor=%22<?=urlencode($this->lookfor)?>%22&type=Series diff --git a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-subject.phtml b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-subject.phtml index 6424a15c886..187e19bd3eb 100644 --- a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-subject.phtml +++ b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-subject.phtml @@ -1 +1,2 @@ -<?=$this->url('search-results')?>?lookfor=%22<?=urlencode($this->lookfor)?>%22&type=Subject +<?php $searchRoute = $this->searchOptions($this->driver->getSourceIdentifier())->getSearchAction(); ?> +<?=$this->url($searchRoute)?>?lookfor=%22<?=urlencode($this->lookfor)?>%22&type=Subject diff --git a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-title.phtml b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-title.phtml index 163ccdcb55b..591cc334703 100644 --- a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-title.phtml +++ b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/link-title.phtml @@ -1 +1,2 @@ -<?=$this->url('search-results')?>?lookfor=%22<?=urlencode($this->lookfor)?>%22&type=Title +<?php $searchRoute = $this->searchOptions($this->driver->getSourceIdentifier())->getSearchAction(); ?> +<?=$this->url($searchRoute)?>?lookfor=%22<?=urlencode($this->lookfor)?>%22&type=Title -- GitLab