2 declare(strict_types = 1);
21 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
22 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
23 use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
45 use CompileWithRenderStatic;
52 $this->registerArgument(
'route',
'string',
'The route to link to',
true);
53 $this->registerArgument(
'arguments',
'array',
'Additional link arguments',
false, []);
54 $this->registerArgument(
'query',
'string',
'Additional link arguments as string');
55 $this->registerArgument(
'currentUrlParameterName',
'string',
'Add current url as given parameter');
66 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext):
string
68 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
69 $parameters = $arguments[
'arguments'];
70 if ($arguments[
'query'] !==
null) {
73 if ($arguments[
'currentUrlParameterName'] !==
null) {
74 $parameters[$arguments[
'currentUrlParameterName']] = GeneralUtility::getIndpEnv(
'REQUEST_URI');
77 return (
string)$uriBuilder->buildUriFromRoute($arguments[
'route'], $parameters);