-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d58eaf4
commit 991327d
Showing
5 changed files
with
54 additions
and
13 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
Classes/EventListener/BeforeSearchResultIsShownEventListener.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace StudioMitte\SolrNumberedPagination\EventListener; | ||
|
||
use ApacheSolrForTypo3\Solr\Event\Search\BeforeSearchResultIsShownEvent; | ||
use ApacheSolrForTypo3\Solr\Pagination\ResultsPaginator; | ||
use GeorgRinger\NumberedPagination\NumberedPagination; | ||
use TYPO3\CMS\Core\Pagination\SlidingWindowPagination; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
|
||
class BeforeSearchResultIsShownEventListener | ||
{ | ||
|
||
public function __invoke(BeforeSearchResultIsShownEvent $event) | ||
{ | ||
$searchResultSet = $event->getResultSet(); | ||
$currentPage = $event->getCurrentPage(); | ||
$itemsPerPage = ($searchResultSet->getUsedResultsPerPage() ?: 10); | ||
$maximumNumberOfLinks = ($event->getPagination()->getMaxPageNumbers() ?: 10); | ||
$paginator = GeneralUtility::makeInstance(ResultsPaginator::class, $searchResultSet, $currentPage, $itemsPerPage); | ||
|
||
$event->setPagination(GeneralUtility::makeInstance(NumberedPagination::class, $paginator, $maximumNumberOfLinks)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
services: | ||
_defaults: | ||
autowire: false | ||
autoconfigure: true | ||
|
||
StudioMitte\SolrNumberedPagination\: | ||
resource: '../Classes/*' | ||
|
||
StudioMitte\SolrNumberedPagination\EventListener\BeforeSearchResultIsShownEventListener: | ||
tags: | ||
- name: event.listener | ||
identifier: 'solr_numbered_pagination/pagination' | ||
event: ApacheSolrForTypo3\Solr\Event\Search\BeforeSearchResultIsShownEvent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,11 +7,11 @@ | |
'author' => 'Georg Ringer', | ||
'author_email' => '[email protected]', | ||
'state' => 'stable', | ||
'version' => '1.0.1', | ||
'version' => '1.0.2', | ||
'constraints' => [ | ||
'depends' => [ | ||
'typo3' => '10.4.0-11.5.99', | ||
'solr' => '11.5.0-11.5.99', | ||
'typo3' => '10.4.0-12.4.99', | ||
'solr' => '11.5.0-12.99.99', | ||
'numbered_pagination' => '1.0.0-1.99.99', | ||
], | ||
'conflicts' => [], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
<?php | ||
|
||
$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class); | ||
$signalSlotDispatcher->connect( | ||
\ApacheSolrForTypo3\Solr\Controller\SearchController::class, | ||
'resultsAction', | ||
\StudioMitte\SolrNumberedPagination\Slot\SolrResultActionSlot::class, | ||
'run' | ||
); | ||
if ((new \TYPO3\CMS\Core\Information\Typo3Version())->getMajorVersion() < 12) { | ||
$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class); | ||
$signalSlotDispatcher->connect( | ||
\ApacheSolrForTypo3\Solr\Controller\SearchController::class, | ||
'resultsAction', | ||
\StudioMitte\SolrNumberedPagination\Slot\SolrResultActionSlot::class, | ||
'run' | ||
); | ||
} |