diff --git a/module/VuFind/src/VuFind/Record/Router.php b/module/VuFind/src/VuFind/Record/Router.php index 008f1f85edc14aba8db78c38d5da62c0df136e0c..49685fd27fdc84c1a3abe5979a6223479b97b1e0 100644 --- a/module/VuFind/src/VuFind/Record/Router.php +++ b/module/VuFind/src/VuFind/Record/Router.php @@ -85,14 +85,20 @@ class Router * @param \VuFind\RecordDriver\AbstractBase|string $driver Record driver * representing record to link to, or source|id pipe-delimited string * @param string $tab Action to access + * @param array $query Optional query params * * @return array */ - public function getTabRouteDetails($driver, $tab = null) + public function getTabRouteDetails($driver, $tab = null, $query = []) { $route = $this->getRouteDetails( $driver, '', empty($tab) ? [] : ['tab' => $tab] ); + // Add the options and query elements only if we need a query to avoid + // an empty element in the route definition: + if ($query) { + $route['options']['query'] = $query; + } // If collections are active and the record route was selected, we need // to check if the driver is actually a collection; if so, we should switch diff --git a/module/VuFind/src/VuFind/View/Helper/Root/RecordLink.php b/module/VuFind/src/VuFind/View/Helper/Root/RecordLink.php index 59c2814aa91726afb539ff4f7491020f16c06119..fb4e746f063e23ac14e14dbfd33508af32e5aeb8 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/RecordLink.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/RecordLink.php @@ -180,15 +180,18 @@ class RecordLink extends \Zend\View\Helper\AbstractHelper * representing record to link to, or source|id pipe-delimited string * @param string $tab Optional record * tab to access + * @param array $query Optional query params * * @return string */ - public function getTabUrl($driver, $tab = null) + public function getTabUrl($driver, $tab = null, $query = []) { // Build the URL: $urlHelper = $this->getView()->plugin('url'); - $details = $this->router->getTabRouteDetails($driver, $tab); - return $urlHelper($details['route'], $details['params']); + $details = $this->router->getTabRouteDetails($driver, $tab, $query); + return $urlHelper( + $details['route'], $details['params'], $details['options'] ?? [] + ); } /** diff --git a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/result-list.phtml b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/result-list.phtml index c97910034a87922bfc51e4ee819996690cac8d53..e6409a3af1b9cecd04b0c2d43e1b5df148475e8b 100644 --- a/themes/bootstrap3/templates/RecordDriver/DefaultRecord/result-list.phtml +++ b/themes/bootstrap3/templates/RecordDriver/DefaultRecord/result-list.phtml @@ -198,7 +198,7 @@ <div class="hierarchyTreeLink"> <input type="hidden" value="<?=$this->escapeHtmlAttr($hierarchyID)?>" class="hiddenHierarchyId" /> <i class="result-link-icon fa fa-fw fa-sitemap" aria-hidden="true"></i> - <a class="hierarchyTreeLinkText result-link-label" data-lightbox href="<?=$this->recordLink()->getTabUrl($this->driver, 'HierarchyTree')?>?hierarchy=<?=urlencode($hierarchyID)?>#tabnav" title="<?=$this->transEsc('hierarchy_tree')?>" data-lightbox-href="<?=$this->recordLink()->getTabUrl($this->driver, 'AjaxTab')?>?hierarchy=<?=urlencode($hierarchyID)?>" data-lightbox-post="tab=hierarchytree"> + <a class="hierarchyTreeLinkText result-link-label" data-lightbox href="<?=$this->recordLink()->getTabUrl($this->driver, 'HierarchyTree', ['hierarchy' => $hierarchyID])?>#tabnav" title="<?=$this->transEsc('hierarchy_tree')?>" data-lightbox-href="<?=$this->recordLink()->getTabUrl($this->driver, 'AjaxTab', ['hierarchy' => $hierarchyID])?>" data-lightbox-post="tab=hierarchytree"> <?=$this->transEsc('hierarchy_view_context')?><?php if (count($trees) > 1): ?>: <?=$this->escapeHtml($hierarchyTitle)?><?php endif; ?> </a> </div> diff --git a/themes/bootstrap3/templates/RecordDriver/EDS/result-list.phtml b/themes/bootstrap3/templates/RecordDriver/EDS/result-list.phtml index 066344817c91da0a37a48b86f029e9d40d4b3284..1328784fbf4ff3339cf1e7528d724f8ef88d914f 100644 --- a/themes/bootstrap3/templates/RecordDriver/EDS/result-list.phtml +++ b/themes/bootstrap3/templates/RecordDriver/EDS/result-list.phtml @@ -126,7 +126,7 @@ <div class="hierarchyTreeLink"> <input type="hidden" value="<?=$this->escapeHtmlAttr($hierarchyID)?>" class="hiddenHierarchyId" /> <i class="fa fa-fw fa-sitemap" aria-hidden="true"></i> - <a class="hierarchyTreeLinkText" data-lightbox href="<?=$this->recordLink()->getTabUrl($this->driver, 'HierarchyTree')?>?hierarchy=<?=urlencode($hierarchyID)?>#tabnav" title="<?=$this->transEsc('hierarchy_tree')?>"> + <a class="hierarchyTreeLinkText" data-lightbox href="<?=$this->recordLink()->getTabUrl($this->driver, 'HierarchyTree', ['hierarchy' => $hierarchyID])?>#tabnav" title="<?=$this->transEsc('hierarchy_tree')?>"> <?=$this->transEsc('hierarchy_view_context')?><?php if (count($trees) > 1): ?>: <?=$this->escapeHtml($hierarchyTitle)?><?php endif; ?> </a> </div> diff --git a/themes/bootstrap3/templates/RecordTab/hierarchytree.phtml b/themes/bootstrap3/templates/RecordTab/hierarchytree.phtml index 630d4be321e1b4059a8d2380fb9a694afdc5427c..f21040fa36157260e7f01fce29557e2a0752d6f9 100644 --- a/themes/bootstrap3/templates/RecordTab/hierarchytree.phtml +++ b/themes/bootstrap3/templates/RecordTab/hierarchytree.phtml @@ -26,7 +26,7 @@ <?php if($activeTree == $hierarchy): ?> <i class="fa fa-sitemap" aria-hidden="true"></i> <?=$this->escapeHtml($hierarchyTitle)?> <?php else: ?> - <i class="fa fa-sitemap text-muted" aria-hidden="true"></i> <a href="<?=$this->recordLink()->getTabUrl($this->driver, 'HierarchyTree')?>?hierarchy=<?=urlencode($hierarchy)?>"><?=$this->escapeHtml($hierarchyTitle)?></a> + <i class="fa fa-sitemap text-muted" aria-hidden="true"></i> <a href="<?=$this->recordLink()->getTabUrl($this->driver, 'HierarchyTree', ['hierarchy' => $hierarchy])?>"><?=$this->escapeHtml($hierarchyTitle)?></a> <?php endif; ?> <?php endforeach; ?> </div> diff --git a/themes/bootstrap3/templates/RecordTab/holdingsils.phtml b/themes/bootstrap3/templates/RecordTab/holdingsils.phtml index 8c4f33b0b273fe87c994f81c7017fd8b134bcd88..934039e77fc6f7f30fe2eed8e1f4981161d9913d 100644 --- a/themes/bootstrap3/templates/RecordTab/holdingsils.phtml +++ b/themes/bootstrap3/templates/RecordTab/holdingsils.phtml @@ -32,11 +32,11 @@ <?php if ($account->loginEnabled() && $offlineMode != 'ils-offline'): ?> <?php if (!$user): ?> <div class="alert alert-info"> - <a href="<?=$this->recordLink()->getTabUrl($this->driver, 'Holdings')?>?login=true&catalogLogin=true" data-lightbox><?=$this->transEsc("hold_login")?></a> + <a href="<?=$this->recordLink()->getTabUrl($this->driver, 'Holdings', ['login' => 'true', 'catalogLogin' => 'true'])?>" data-lightbox><?=$this->transEsc("hold_login")?></a> </div> <?php elseif (!$user->cat_username): ?> <div class="alert alert-info"> - <?=$this->translate("hold_profile_html", ['%%url%%' => $this->recordLink()->getTabUrl($this->driver, 'Holdings') . '?catalogLogin=true'])?> + <?=$this->translate("hold_profile_html", ['%%url%%' => $this->recordLink()->getTabUrl($this->driver, 'Holdings', ['catalogLogin' => 'true'])])?> </div> <?php endif; ?> <?php endif; ?>