Skip to content

Commit 40571fe

Browse files
Merge pull request #2 from beatrycze-volk/fix-missing-title
[BUGFIX] Fix displaying for missing title
2 parents affd705 + ce0e821 commit 40571fe

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

Classes/Common/SolrPaginator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ public function __construct(
4242
protected function updatePaginatedItems(int $itemsPerPage, int $offset): void
4343
{
4444
$this->solrSearch->submit($offset, $itemsPerPage);
45-
$this->paginatedItems = $this->solrSearch->toArray();
45+
foreach ($this->solrSearch as $item) {
46+
$this->paginatedItems[] = $item;
47+
}
4648
}
4749

4850
protected function getTotalAmountOfItems(): int

Classes/Controller/CollectionController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ public function showAction(?Collection $collection = null): void
177177
$sortableMetadata = $this->metadataRepository->findByIsSortable(true);
178178

179179
$solrResults = $this->documentRepository->findSolrByCollection($collection, $this->settings, $this->searchParams, $listedMetadata);
180-
$numResults = $solrResults->getNumFound();
181180

182181
$itemsPerPage = $this->settings['list']['paginate']['itemsPerPage'] ?? 25;
183182

@@ -188,8 +187,8 @@ public function showAction(?Collection $collection = null): void
188187
$this->view->assignMultiple([ 'pagination' => $pagination, 'paginator' => $solrPaginator ]);
189188

190189
$this->view->assign('viewData', $this->viewData);
191-
$this->view->assign('documents', !empty($solrResults) ? $solrResults : []);
192-
$this->view->assign('numResults', $numResults);
190+
$this->view->assign('countDocuments', $solrResults->count());
191+
$this->view->assign('countResults', $solrResults->getNumFound());
193192
$this->view->assign('collection', $collection);
194193
$this->view->assign('page', $currentPage);
195194
$this->view->assign('lastSearch', $this->searchParams);

Classes/Controller/ListViewController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,8 @@ public function mainAction(): void
101101
// get all metadata records to be shown in results
102102
$listedMetadata = $this->metadataRepository->findByIsListed(true);
103103

104-
$numResults = 0;
105104
if (!empty($this->searchParams)) {
106105
$solrResults = $this->documentRepository->findSolrWithoutCollection($this->settings, $this->searchParams, $listedMetadata);
107-
$numResults = $solrResults->getNumFound();
108106

109107
$itemsPerPage = $this->settings['list']['paginate']['itemsPerPage'] ?? 25;
110108

@@ -116,8 +114,8 @@ public function mainAction(): void
116114
}
117115

118116
$this->view->assign('viewData', $this->viewData);
119-
$this->view->assign('documents', !empty($solrResults) ? $solrResults : []);
120-
$this->view->assign('numResults', $numResults);
117+
$this->view->assign('countDocuments', !empty($solrResults) ? $solrResults->count() : 0);
118+
$this->view->assign('countResults', !empty($solrResults) ? $solrResults->getNumFound() : 0);
121119
$this->view->assign('page', $currentPage);
122120
$this->view->assign('lastSearch', $this->searchParams);
123121
$this->view->assign('sortableMetadata', $sortableMetadata);

Resources/Private/Partials/ListView/SearchHits.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
data-namespace-typo3-fluid="true">
1414

1515
<p class="tx-dlf-search-numHits">
16-
<f:translate key="listview.hits" arguments="{0: '{numResults}', 1: '{documents->f:count()}'}" />
16+
<f:translate key="listview.hits" arguments="{0: '{countResults}', 1: '{countDocuments}'}" />
1717
</p>
1818
</html>

Resources/Private/Templates/ListView/Main.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ <h2 class="tx-dlf-listview-label">
2727
<f:variable name="action" value="main" />
2828
<f:variable name="controller" value="ListView" />
2929

30-
<f:if condition="{numResults} > 0">
30+
<f:if condition="{countResults} > 0">
3131
<f:render partial="ListView/SortingForm" arguments="{_all}" />
3232
<f:render partial="ListView/Results" arguments="{_all}" />
3333
</f:if>

Resources/Private/Templates/Search/Main.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
<f:render partial="ListView/SearchHits" arguments="{_all}" />
119119
<f:variable name="action" value="search" />
120120
<f:variable name="controller" value="Search" />
121-
<f:if condition="{numResults} > 0">
121+
<f:if condition="{countResults} > 0">
122122
<f:render partial="ListView/SortingForm" arguments="{_all}" />
123123
<f:render partial="ListView/Results" arguments="{_all}" />
124124
</f:if>

0 commit comments

Comments
 (0)