From 9f35cb83ce7ec25a8ad296d9102282ae09004452 Mon Sep 17 00:00:00 2001 From: Juha Luoma <33253757+LuomaJuha@users.noreply.github.com> Date: Wed, 18 Dec 2024 14:29:57 +0200 Subject: [PATCH 1/3] Adjusted to show collection list tab only if the record is a collection --- module/VuFind/src/VuFind/RecordTab/CollectionList.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/module/VuFind/src/VuFind/RecordTab/CollectionList.php b/module/VuFind/src/VuFind/RecordTab/CollectionList.php index 9ebd305edcc..292ce71d367 100644 --- a/module/VuFind/src/VuFind/RecordTab/CollectionList.php +++ b/module/VuFind/src/VuFind/RecordTab/CollectionList.php @@ -117,6 +117,16 @@ public function getParams() return $this->getResults()->getParams(); } + /** + * Is this tab active? + * + * @return bool + */ + public function isActive() + { + return parent::isActive() && $this->getRecordDriver()->tryMethod('isCollection'); + } + /** * Get the processed search results. * From 84ec1ec7aba3083ee3c83b9534984c448151d407 Mon Sep 17 00:00:00 2001 From: Juha Luoma <33253757+LuomaJuha@users.noreply.github.com> Date: Wed, 18 Dec 2024 14:44:41 +0200 Subject: [PATCH 2/3] Use getHierarchyTrees to determine if tab is viable --- module/VuFind/src/VuFind/RecordTab/CollectionList.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/VuFind/src/VuFind/RecordTab/CollectionList.php b/module/VuFind/src/VuFind/RecordTab/CollectionList.php index 292ce71d367..34f402f445d 100644 --- a/module/VuFind/src/VuFind/RecordTab/CollectionList.php +++ b/module/VuFind/src/VuFind/RecordTab/CollectionList.php @@ -124,7 +124,7 @@ public function getParams() */ public function isActive() { - return parent::isActive() && $this->getRecordDriver()->tryMethod('isCollection'); + return parent::isActive() && $this->getRecordDriver()->tryMethod('getHierarchyTrees'); } /** From fe43d88f3eedfba6c7b7a3958a53b61f655738c2 Mon Sep 17 00:00:00 2001 From: Juha Luoma <33253757+LuomaJuha@users.noreply.github.com> Date: Thu, 19 Dec 2024 14:03:43 +0200 Subject: [PATCH 3/3] Adjusted to only work with collection records if not in collection view --- module/VuFind/src/VuFind/RecordTab/CollectionList.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/VuFind/src/VuFind/RecordTab/CollectionList.php b/module/VuFind/src/VuFind/RecordTab/CollectionList.php index 34f402f445d..292ce71d367 100644 --- a/module/VuFind/src/VuFind/RecordTab/CollectionList.php +++ b/module/VuFind/src/VuFind/RecordTab/CollectionList.php @@ -124,7 +124,7 @@ public function getParams() */ public function isActive() { - return parent::isActive() && $this->getRecordDriver()->tryMethod('getHierarchyTrees'); + return parent::isActive() && $this->getRecordDriver()->tryMethod('isCollection'); } /**