1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the TYPO3 CMS project. |
7
|
|
|
* |
8
|
|
|
* It is free software; you can redistribute it and/or modify it under |
9
|
|
|
* the terms of the GNU General Public License, either version 2 |
10
|
|
|
* of the License, or any later version. |
11
|
|
|
* |
12
|
|
|
* For the full copyright and license information, please read the |
13
|
|
|
* LICENSE.txt file that was distributed with this source code. |
14
|
|
|
* |
15
|
|
|
* The TYPO3 project - inspiring people to share! |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
namespace ApacheSolrForTypo3\Solr\ViewHelpers\Uri\Paginate; |
19
|
|
|
|
20
|
|
|
use ApacheSolrForTypo3\Solr\ViewHelpers\Uri\AbstractUriViewHelper; |
21
|
|
|
use Closure; |
22
|
|
|
use TYPO3\CMS\Extbase\Object\Exception as ExtbaseObjectException; |
23
|
|
|
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Class ResultPageViewHelper |
27
|
|
|
* |
28
|
|
|
* @author Frans Saris <[email protected]> |
29
|
|
|
* @author Timo Hund <[email protected]> |
30
|
|
|
*/ |
31
|
|
|
class ResultPageViewHelper extends AbstractUriViewHelper |
32
|
|
|
{ |
33
|
|
|
/** |
34
|
|
|
* Initializes the arguments |
35
|
|
|
*/ |
36
|
26 |
|
public function initializeArguments() |
37
|
|
|
{ |
38
|
26 |
|
parent::initializeArguments(); |
39
|
26 |
|
$this->registerArgument('page', 'int', 'The page', false, 0); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @param array $arguments |
44
|
|
|
* @param Closure $renderChildrenClosure |
45
|
|
|
* @param RenderingContextInterface $renderingContext |
46
|
|
|
* @return string |
47
|
|
|
* @throws ExtbaseObjectException |
48
|
|
|
* |
49
|
|
|
* @noinspection PhpMissingReturnTypeInspection |
50
|
|
|
*/ |
51
|
2 |
|
public static function renderStatic(array $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) |
52
|
|
|
{ |
53
|
2 |
|
$page = $arguments['page']; |
54
|
2 |
|
$previousRequest = static::getUsedSearchRequestFromRenderingContext($renderingContext); |
55
|
2 |
|
return self::getSearchUriBuilder($renderingContext)->getResultPageUri($previousRequest, $page); |
|
|
|
|
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|