Commit 90410114 authored by Stefan Galinski's avatar Stefan Galinski

Merge branch 'feature_UpgradeTo9LTS' into 'master'

Feature upgrade to9 lts

See merge request !8
parents 64ce687f 3e31f528
This diff is collapsed.
......@@ -69,14 +69,14 @@ class RouteRepository extends Repository {
$constraints = [];
if (isset($filters['categories']) && is_array($filters['categories']) && count($filters['categories'])) {
if (isset($filters['categories']) && \is_array($filters['categories']) && \count($filters['categories'])) {
$categoryConstraints = [];
foreach ($filters['categories'] as $category) {
if ((int) $category) {
$categoryConstraints[] = $query->contains('categories', $category);
}
}
if (count($categoryConstraints)) {
if (\count($categoryConstraints)) {
$constraints[] = $query->logicalOr($categoryConstraints);
}
}
......@@ -91,9 +91,9 @@ class RouteRepository extends Repository {
$constraints[] = $query->logicalOr($searchConstraints);
}
if (count($constraints) > 1) {
if (\count($constraints) > 1) {
$query->matching($query->logicalAnd($constraints));
} elseif (count($constraints)) {
} elseif (\count($constraints)) {
$query->matching($constraints[0]);
}
......
<?php
namespace SGalinski\SgRoutes\Middleware;
/**
*
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
*/
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
/**
* Resolver for generating frontend links
*
* @package SGalinski\SgRoutes\Middleware
* @author Kevin Ditscheid <kevin.ditscheid@sgalinski.de>
*/
class FrontendLinkResolver implements MiddlewareInterface {
/**
* Process an incoming server request.
*
* Processes an incoming server request in order to produce a response.
* If unable to produce the response itself, it may delegate to the provided
* request handler to do so.
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface {
$queryParams = $request->getQueryParams();
if (!isset($queryParams['tx_sgroutes_frontendlink'])) {
return $handler->handle($request);
}
$contentObjectRenderer = GeneralUtility::makeInstance(ContentObjectRenderer::class);
$response = new Response();
$response->getBody()
->write(
$contentObjectRenderer->typoLink(
'',
[
'parameter' => $queryParams['tx_sgroutes_frontendlink']['destination_url'],
'returnLast' => 'url'
]
)
);
return $response;
}
}
<?php
namespace SGalinski\SgRoutes\Middleware;
/**
*
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
*/
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use SGalinski\SgRoutes\Service\LicensingService;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Http\RedirectResponse;
use TYPO3\CMS\Core\Http\Uri;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use TYPO3\CMS\Frontend\Controller\ErrorController;
use TYPO3\CMS\Frontend\Page\PageAccessFailureReasons;
use TYPO3\CMS\Frontend\Page\PageRepository;
/**
* Middleware resolver class for the sg_routes
*
* @package SGalinski\SgRoutes\Middleware
* @author Kevin Ditscheid <kevin.ditscheid@sgalinski.de>
*/
class RedirectResolver implements MiddlewareInterface {
const URL_WIZARD_ID = 't3://page?uid=';
/**
* Process an incoming server request.
*
* Processes an incoming server request in order to produce a response.
* If unable to produce the response itself, it may delegate to the provided
* request handler to do so.
*
* @param ServerRequestInterface $request
* @param RequestHandlerInterface $handler
* @return ResponseInterface
* @throws \TYPO3\CMS\Core\Error\Http\PageNotFoundException
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface {
$start = \microtime(TRUE);
$uri = $request->getUri();
$requestParameters = $request->getQueryParams();
$requestParameterPageId = NULL;
$filteredRequestParameters = [];
foreach ($requestParameters as $key => $splittedParameter) {
if ($key === 'id') {
continue;
}
$filteredRequestParameters[$key] = $splittedParameter;
}
$requestParameters = $filteredRequestParameters;
$uri = $uri->withQuery('');
$rootUid = $request->getAttribute('site')->getRootPageId();
if ($rootUid) {
if ($GLOBALS['TYPO3_CONF_VARS']['FE']['tx_routes_executed'][$rootUid]) {
// already redirected the route to $rootUid, proceed with page loading
return $handler->handle($request);
}
$GLOBALS['TYPO3_CONF_VARS']['FE']['tx_routes_executed'][$rootUid] = TRUE;
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_sgroutes_domain_model_route');
$queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
$resultArray = $queryBuilder->select(
'uid',
'pid',
'use_regular_expression',
'source_url',
'source_url_case_sensitive',
'destination_url',
'redirect_url_parameters',
'redirect_code',
'description')
->from('tx_sgroutes_domain_model_route')
->where(
$queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($rootUid, \PDO::PARAM_INT))
)
->orderBy('sorting')
->execute()->fetchAll();
if ($resultArray) {
foreach ($resultArray as $redirect) {
if ($redirect['source_url'] === '' || $redirect['destination_url'] === '') {
continue;
}
if ($redirect['use_regular_expression'] && LicensingService::checkKey()) {
$pattern = '/' . \str_replace('/', '\\/', $redirect['source_url']) . '/is';
if ($redirect['redirect_url_parameters']) {
$uri = $uri->withQuery($request->getUri()->getQuery());
} elseif (!empty($requestParameters)) {
$uri = $uri->withQuery(GeneralUtility::implodeArrayForUrl('', $requestParameters));
}
if (\preg_match($pattern, \rawurldecode($uri))) {
$redirectUri = \preg_replace(
$pattern, $redirect['destination_url'], \rawurldecode($uri)
);
$this->logRedirect(
$redirect, \rawurldecode($uri), $redirectUri, $start, \microtime(TRUE)
);
return new RedirectResponse($redirectUri, $redirect['redirect_code']);
}
} else {
$sourceUrl = new Uri($redirect['source_url']);
$uri = $uri->withPath(\trim($uri->getPath(), '/'));
$sourceUrl = $sourceUrl->withPath(\trim($sourceUrl->getPath()));
if ($sourceUrl->getHost() === '') {
$uri = $uri->withHost('')->withScheme(NULL);
}
if (
(
(bool)$redirect['source_url_case_sensitive'] &&
(string) $uri === (string) $sourceUrl
) ||
(
!(bool)$redirect['source_url_case_sensitive'] &&
\mb_strtolower($uri) === \mb_strtolower($sourceUrl)
)
) {
$destinationUrl = $redirect['destination_url'];
if (\strpos($destinationUrl, self::URL_WIZARD_ID) === 0) {
$destinationUrl = (int) \substr($destinationUrl, 14);
}
if (\is_numeric($destinationUrl)) {
$GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance(PageRepository::class);
$contentObjectRenderer = GeneralUtility::makeInstance(ContentObjectRenderer::class, $GLOBALS['TSFE']);
$redirectUri = $contentObjectRenderer->typoLink_URL([
'parameter' => $destinationUrl,
'additionalParams' => '&' . \implode('&', $requestParameters)
]);
if ($redirectUri === '') {
// the page either does not exist or isn't accessible, drop out
return GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
$request,
'The page with id #' . $destinationUrl . ' could not be found!',
['code' => PageAccessFailureReasons::PAGE_NOT_FOUND]
);
} else {
$this->logRedirect(
$redirect, \rawurldecode($uri), $redirectUri, $start, \microtime(TRUE)
);
return new RedirectResponse($redirectUri, $redirect['redirect_code']);
}
}
}
}
}
}
}
return $handler->handle($request);
}
/**
* @param array $routeRow
* @param string $requestUri
* @param string $redirectUri
* @param float $start
* @param float $end
* @return void
* @throws \InvalidArgumentException
*/
private function logRedirect($routeRow, $requestUri, $redirectUri, $start, $end): void {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_sgroutes_domain_model_log');
$queryBuilder->getRestrictions()->removeAll();
$categories = $queryBuilder->select('c.title')
->from('tx_sgroutes_domain_model_category', 'c')
->innerJoin('c', 'tx_sgroutes_domain_model_route_category', 'mm', 'c.uid = mm.uid_foreign')
->where(
$queryBuilder->expr()->eq('mm.uid_local', $queryBuilder->createNamedParameter($routeRow['uid'], \PDO::PARAM_INT))
)
->orderBy('mm.sorting')
->execute()->fetchAll();
$insertRow = [
'pid' => $routeRow['pid'],
'use_regular_expression' => $routeRow['use_regular_expression'],
'source_url' => $routeRow['source_url'],
'destination_url' => $routeRow['destination_url'],
'redirect_url_parameters' => $routeRow['redirect_url_parameters'],
'redirect_code' => $routeRow['redirect_code'],
'description' => $routeRow['description'],
'categories' => '',
'request_url' => $requestUri,
'redirect_url' => $redirectUri,
'execution_duration' => 1000 * ($end - $start),
'crdate' => $GLOBALS['EXEC_TIME'],
];
if ($categories) {
/** @var array $category */
foreach ($categories as $i => $category) {
if ($insertRow['categories'] !== '') {
$insertRow['categories'] .= ', ';
}
$insertRow['categories'] .= $category['category_title'];
}
}
$queryBuilder->resetQueryParts();
$queryBuilder->insert('tx_sgroutes_domain_model_log')
->values($insertRow)
->execute();
}
}
......@@ -28,7 +28,9 @@ namespace SGalinski\SgRoutes\Service;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use SGalinski\SgRoutes\Utility\ExtensionUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Http\NullResponse;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
......@@ -54,9 +56,9 @@ class LicensingService {
public static function checkKey(): bool {
if (static::$isLicenseKeyValid === NULL) {
static::$isLicenseKeyValid = FALSE;
$configuration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::EXTENSION_KEY], [FALSE]);
if (isset($configuration['key']) && $key = trim($configuration['key'])) {
static::$isLicenseKeyValid = (bool) preg_match('/^([A-Z\d]{6}-?){4}$/', $key);
$configuration = ExtensionUtility::getExtensionConfiguration();
if (isset($configuration['key']) && $key = \trim($configuration['key'])) {
static::$isLicenseKeyValid = (bool) \preg_match('/^([A-Z\d]{6}-?){4}$/', $key);
}
}
......@@ -71,19 +73,19 @@ class LicensingService {
*/
public static function ping($returnUrl = FALSE): string {
try {
$configuration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::EXTENSION_KEY], [FALSE]);
$configuration = ExtensionUtility::getExtensionConfiguration();
$key = '';
if (isset($configuration['key'])) {
$key = trim($configuration['key']);
$key = \trim($configuration['key']);
}
$params = [
'extension' => self::EXTENSION_KEY,
'host' => GeneralUtility::getIndpEnv('HTTP_HOST'),
'key' => $key
];
$params = http_build_query($params);
$params = \http_build_query($params);
$pingUrl = self::URL;
$pingUrl .= $params !== '' ? (strpos($pingUrl, '?') === FALSE ? '?' : '&') . $params : '';
$pingUrl .= $params !== '' ? (\strpos($pingUrl, '?') === FALSE ? '?' : '&') . $params : '';
if ($returnUrl) {
return $pingUrl;
}
......@@ -103,13 +105,16 @@ class LicensingService {
* @return ResponseInterface
* @throws \InvalidArgumentException
*/
public function ajaxPing(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface {
public function ajaxPing(ServerRequestInterface $request, ResponseInterface $response = NULL): ResponseInterface {
/** @var BackendUserAuthentication $backendUser */
$backendUser = $GLOBALS['BE_USER'];
if ($backendUser && !$backendUser->getModuleData('tools_beuser/index.php/web_SgRoutesRoute_pinged', 'ses')) {
$backendUser->pushModuleData('tools_beuser/index.php/web_SgRoutesRoute_pinged', TRUE);
self::ping();
}
if ($response === NULL) {
$response = new NullResponse();
}
return $response;
}
}
This diff is collapsed.
<?php
namespace SGalinski\SgRoutes\Utility;
/**
*
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
*/
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
/**
* Class ExtensionUtility
*
* @package SGalinski\SgRoutes\Utility
* @author Kevin Ditscheid <kevin.ditscheid@sgalinski.de>
*/
class ExtensionUtility {
/**
* Get the extension configuration
*
* @return array
*/
public static function getExtensionConfiguration(): array {
return $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sg_routes'] ?? [];
}
}
......@@ -34,14 +34,22 @@ namespace SGalinski\SgRoutes\ViewHelpers;
* <lfe:addJavaScriptFile javaScriptFile="{f:uri.resource(path: 'Scripts/Frontend.js')}" />
*/
class AddJavaScriptFileViewHelper extends AbstractViewHelper {
/**
* Register the ViewHelper arguments
*/
public function initializeArguments() {
parent::initializeArguments();
$this->registerArgument('javaScriptFile', 'string', 'The file to include', TRUE);
}
/**
* Adds a custom javascript file
*
* @param string $javaScriptFile
* @return void
*/
public function render($javaScriptFile) {
$javaScriptFile = (TYPO3_MODE === 'FE' ? $this->getBaseUrl() : '') . $javaScriptFile;
public function render() {
$javaScriptFile = (TYPO3_MODE === 'FE' ? $this->getBaseUrl() : '') . $this->arguments['javaScriptFile'];
$this->getPageRenderer()->addJsFile($javaScriptFile);
}
}
......@@ -26,30 +26,42 @@ namespace SGalinski\SgRoutes\ViewHelpers\Backend;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use\TYPO3\CMS\Backend\Clipboard\Clipboard;
use TYPO3\CMS\Backend\Clipboard\Clipboard;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList;
/**
* Class ControlViewHelper
**/
class ControlViewHelper extends AbstractViewHelper {
/**
* Initialize the ViewHelper arguments
*/
public function initializeArguments() {
parent::initializeArguments();
$this->registerArgument('table', 'string', 'The table to control', TRUE);
$this->registerArgument('row', 'mixed', 'The row of the record', TRUE);
$this->registerArgument('sortingData', 'array', 'The sorting data', FALSE, []);
$this->registerArgument('clipboard', 'bool', 'Use the clipboard', FALSE, FALSE);
}
/**
* Renders the control buttons for the specified record
*
* @param string $table
* @param mixed $row
* @param array $sortingData
* @param boolean $clipboard
* @return string
* @throws \InvalidArgumentException
* @throws \UnexpectedValueException
*/
public function render($table, $row, $sortingData = [], $clipboard = FALSE) {
if (!is_array($row)) {
public function render() {
$table = $this->arguments['table'];
$row = $this->arguments['row'];
$sortingData = $this->arguments['sortingData'];
$clipboard = $this->arguments['clipboard'];
if (!\is_array($row)) {
$row = BackendUtility::getRecord($table, $row->getUid());
}
/** @var DatabaseRecordList $databaseRecordList */
......
......@@ -26,22 +26,41 @@ namespace SGalinski\SgRoutes\ViewHelpers\Backend;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* Class EditOnClickViewHelper
**/
class EditLinkViewHelper extends AbstractViewHelper {
/**
* Register the ViewHelpers arguments
*/
public function initializeArguments() {
parent::initializeArguments();
$this->registerArgument('table', 'string', 'The table of the edit link', TRUE);
$this->registerArgument('uid', 'int', 'The uid of the record', TRUE);
$this->registerArgument('new', 'bool', 'Wether the record is new or not', FALSE, FALSE);
}
/**
* Renders the onclick script for editing a record
*
* @param string $table
* @param int $uid
* @param boolean $new
* @return string
* @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException
*/
public function render($table, $uid, $new = FALSE) {
return BackendUtility::getModuleUrl('record_edit') . '&edit[' . $table . '][' . $uid . ']=' . ($new ? 'new' : 'edit');
public function render() {
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
return $uriBuilder->buildUriFromRoute(
'record_edit', [
'edit' => [
$this->arguments['table'] => [
$this->arguments['uid'] => $this->arguments['new'] ? 'new' : 'edit'
]
]
]
);
}
}
......@@ -27,21 +27,31 @@ namespace SGalinski\SgRoutes\ViewHelpers\Backend;
***************************************************************/
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* Class EditOnClickViewHelper
**/
class EditOnClickViewHelper extends AbstractViewHelper {
/**
* Register the ViewHelper arguments
*/
public function initializeArguments() {
parent::initializeArguments();
$this->registerArgument('table', 'string', 'The table for the clickenlarge link', TRUE);
$this->registerArgument('uid', 'int', 'The uid of the record to clickenlarge', TRUE);
$this->registerArgument('new', 'bool', 'Open a new record in the popup', FALSE, FALSE);
}
/**
* Renders the onclick script for editing a record
*
* @param string $table
* @param int $uid
* @param boolean $new
* @return string
*/
public function render($table, $uid, $new = FALSE) {
return BackendUtility::editOnClick('&edit[' . $table . '][' . $uid . ']=' . ($new ? 'new' : 'edit'), '', -1);
public function render() {
return BackendUtility::editOnClick(
'&edit[' . $this->arguments['table'] . '][' . $this->arguments['uid'] . ']=' . ($this->arguments['new'] ? 'new' : 'edit'),
'', -1
);
}
}
......@@ -30,22 +30,33 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* Class IconViewHelper
**/
class IconViewHelper extends AbstractViewHelper {
/**
* Register the ViewHelper arguments
*/
public function initializeArguments() {
parent::initializeArguments();
$this->registerArgument('table', 'string', 'The table for the icon', TRUE);
$this->registerArgument('row', 'mixed', 'The row of the record', TRUE);
$this->registerArgument('clickMenu', 'bool', 'Render a clickMenu around the icon', FALSE, TRUE);
}
/**
* Renders the icon for the specified record
*
* @param string $table
* @param mixed $row
* @param boolean $clickMenu
* @return string
* @throws \InvalidArgumentException
*/
public function render($table, $row, $clickMenu = TRUE) {
public function render() {
$row = $this->arguments['row'];
$table = $this->arguments['table'];
$clickMenu = $this->arguments['clickMenu'];
if (!is_array($row)) {
$row = BackendUtility::getRecord($table, $row->getUid());
}
......@@ -57,8 +68,8 @@ class IconViewHelper extends AbstractViewHelper {
. '</span>';
if ($clickMenu) {
return BackendUtility::wrapClickMenuOnIcon($iconImg, $table, $row['uid']);
} else {
return $iconImg;
}
return $iconImg;
}
}
<?php
namespace SGalinski\SgRoutes\ViewHelpers\Backend\Widget;
/***************************************************************
......@@ -24,6 +25,7 @@ namespace SGalinski\SgRoutes\ViewHelpers\Backend\Widget;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use SGalinski\SgRoutes\ViewHelpers\Backend\Widget\Controller\PaginateController;
use TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetViewHelper;
......@@ -47,18 +49,33 @@ class PaginateViewHelper extends AbstractWidgetViewHelper {
$this->controller = $controller;
}
/**
* Initialize the ViewHelper arguments
*/
public function initializeArguments() {
parent::initializeArguments();
$this->registerArgument('objects', 'mixed', 'The objects to paginate', TRUE);
$this->registerArgument('as', 'string', 'The name of the variable inside the pagination', TRUE);
$this->registerArgument(
'configuration',
'array',
'The configuration of the pagination',
FALSE,
[
'itemsPerPage' => 10,
'insertAbove' => FALSE,
'insertBelow' => TRUE,
'recordsLabel' => ''