Skip to content

Commit e35d1b1

Browse files
committed
Collection-plugin: fix redirect to listview
1 parent 16b0bf9 commit e35d1b1

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

Classes/Controller/CollectionController.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,11 @@ public function showAction(?Collection $collection = null): void
154154
// If a targetPid is given, the results will be shown by Collection on the target page.
155155
if (!empty($this->settings['targetPid'])) {
156156
$this->redirect(
157-
'show',
158-
'Collection',
159-
null,
157+
'main', 'ListView', null,
160158
[
161-
'collection' => $collection
162-
],
163-
$this->settings['targetPid']
159+
'searchParameter' => $search,
160+
'page' => $currentPage
161+
], $this->settings['targetPid']
164162
);
165163
}
166164

Classes/Controller/ListViewController.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ public function mainAction(): void
8686
$GLOBALS['TYPO3_REQUEST']->getAttribute('frontend.user')->setKey('ses', 'search', $search);
8787
}
8888

89+
// extract collection(s) from collection parameter
90+
$collections = [];
91+
if (array_key_exists('collection', $search)) {
92+
foreach(explode(',', $search['collection']) as $collectionEntry) {
93+
$collections[] = $this->collectionRepository->findByUid((int) $collectionEntry);
94+
}
95+
}
96+
8997
// Get current page from request data because the parameter is shared between plugins
9098
$currentPage = $this->requestData['page'] ?? 1;
9199

@@ -96,7 +104,7 @@ public function mainAction(): void
96104
$listedMetadata = $this->metadataRepository->findByIsListed(true);
97105

98106
if (!empty($search)) {
99-
$solrResults = $this->documentRepository->findSolrWithoutCollection($this->settings, $search, $listedMetadata);
107+
$solrResults = $this->documentRepository->findSolrByCollections($collections, $this->settings, $search, $listedMetadata);
100108

101109
$itemsPerPage = $this->settings['list']['paginate']['itemsPerPage'] ?? 25;
102110

0 commit comments

Comments
 (0)