From cc321a9302a4d2d8b21d7bbab3011cae0b139d8b Mon Sep 17 00:00:00 2001 From: Beatrycze Volk Date: Tue, 30 Jun 2026 16:17:49 +0200 Subject: [PATCH] [MAINTENANCE] Correct behavior of 'showSingle' setting in CollectionController The `showSingle` setting previously caused a redirect to a single collection view when it was disabled (empty or false). This change corrects the condition so that the redirect only occurs when `showSingle` is explicitly enabled (`true`), aligning with its intended purpose to directly display a single collection. --- Classes/Controller/CollectionController.php | 2 +- Tests/Functional/Controller/CollectionControllerTest.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Classes/Controller/CollectionController.php b/Classes/Controller/CollectionController.php index b1a06559d..bbce009c3 100644 --- a/Classes/Controller/CollectionController.php +++ b/Classes/Controller/CollectionController.php @@ -97,7 +97,7 @@ public function listAction(): ResponseInterface $collections = $this->collectionRepository->findAll(); } - if (iterator_count($collections) == 1 && empty($this->settings['showSingle']) && is_array($collections)) { + if (iterator_count($collections) == 1 && $this->settings['showSingle'] && is_array($collections)) { return $this->redirect('show', null, null, ['collection' => array_pop($collections)]); } diff --git a/Tests/Functional/Controller/CollectionControllerTest.php b/Tests/Functional/Controller/CollectionControllerTest.php index 020812d9c..6a48d70e4 100644 --- a/Tests/Functional/Controller/CollectionControllerTest.php +++ b/Tests/Functional/Controller/CollectionControllerTest.php @@ -41,7 +41,7 @@ public function canListAction() 'storagePid' => self::$storagePid, 'solrcore' => self::$solrCoreId, 'collections' => '1', - 'showSingle' => '1', + 'showSingle' => '0', 'randomize' => '' ]; $templateHtml = '{item.collection.indexName}'; @@ -62,6 +62,7 @@ public function canListActionForwardToShow() 'storagePid' => self::$storagePid, 'solrcore' => self::$solrCoreId, 'collections' => '1', + 'showSingle' => '1', 'randomize' => '' ]; $controller = $this->setUpController(CollectionController::class, $settings);