‪TYPO3CMS  ‪main
ActionViewHelper.php
Go to the documentation of this file.
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 
19 
22 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
23 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
24 use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
25 
40 final class ‪ActionViewHelper extends AbstractViewHelper
41 {
42  use CompileWithRenderStatic;
43 
44  public function ‪initializeArguments(): void
45  {
46  $this->registerArgument('controller', 'string', 'Target controller.', false, 'maintenance');
47  $this->registerArgument('arguments', 'array', 'Arguments', false, []);
48  $this->registerArgument('section', 'string', 'The anchor to be added to the URI', false, '');
49  $this->registerArgument('additionalParams', 'array', 'additional query parameters that won\'t be prefixed like $arguments (overrule $arguments)', false, []);
50  }
51 
52  public static function ‪renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext): string
53  {
54  $section = $arguments['section'];
55  $additionalParams = $arguments['additionalParams'];
56  $controller = $arguments['controller'];
57  $arguments = $arguments['arguments'];
58 
59  $arguments['controller'] = $controller;
60  if (!empty(‪GeneralUtility::_GET('install')['context'])) {
61  $arguments['context'] = ‪GeneralUtility::_GET('install')['context'];
62  }
63 
64  return GeneralUtility::getIndpEnv('TYPO3_REQUEST_SCRIPT')
66  array_merge(
67  ['install' => $arguments],
68  $additionalParams
69  ),
70  '?'
71  )
72  . ($section ? '#' . $section : '');
73  }
74 }
‪TYPO3\CMS\Install\ViewHelpers\Uri\ActionViewHelper\renderStatic
‪static renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
Definition: ActionViewHelper.php:51
‪TYPO3\CMS\Install\ViewHelpers\Uri\ActionViewHelper
Definition: ActionViewHelper.php:41
‪TYPO3\CMS\Install\ViewHelpers\Uri\ActionViewHelper\initializeArguments
‪initializeArguments()
Definition: ActionViewHelper.php:43
‪TYPO3\CMS\Install\ViewHelpers\Uri
Definition: ActionViewHelper.php:18
‪TYPO3\CMS\Core\Utility\HttpUtility\buildQueryString
‪static string buildQueryString(array $parameters, string $prependCharacter='', bool $skipEmptyParameters=false)
Definition: HttpUtility.php:124
‪TYPO3\CMS\Core\Utility\GeneralUtility\_GET
‪static mixed _GET($var=null)
Definition: GeneralUtility.php:155
‪TYPO3\CMS\Core\Utility\HttpUtility
Definition: HttpUtility.php:24
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:51