‪TYPO3CMS  ‪main
UriViewHelper.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 
42 {
43  public function ‪initializeArguments(): void
44  {
45  parent::initializeArguments();
46  $this->registerArgument('route', 'string', 'The name of the route', true);
47  $this->registerArgument('parameters', 'array', 'An array of parameters', false, []);
48  $this->registerArgument(
49  'referenceType',
50  'string',
51  'The type of reference to be generated (one of the constants)',
52  false,
54  );
55  }
56 
57  public function ‪render(): string
58  {
59  $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
60  $route = $this->arguments['route'];
61  $parameters = $this->arguments['parameters'];
62  $referenceType = $this->arguments['referenceType'];
63  $uri = $uriBuilder->buildUriFromRoute($route, $parameters, $referenceType);
64  return (string)$uri;
65  }
66 }
‪TYPO3\CMS\Fluid\ViewHelpers\Be\UriViewHelper
Definition: UriViewHelper.php:42
‪TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper
Definition: AbstractBackendViewHelper.php:30
‪TYPO3\CMS\Fluid\ViewHelpers\Be
Definition: AbstractBackendViewHelper.php:18
‪TYPO3\CMS\Fluid\ViewHelpers\Be\UriViewHelper\render
‪render()
Definition: UriViewHelper.php:57
‪TYPO3\CMS\Backend\Routing\UriBuilder\ABSOLUTE_PATH
‪const ABSOLUTE_PATH
Definition: UriBuilder.php:53
‪TYPO3\CMS\Backend\Routing\UriBuilder
Definition: UriBuilder.php:44
‪TYPO3\CMS\Fluid\ViewHelpers\Be\UriViewHelper\initializeArguments
‪initializeArguments()
Definition: UriViewHelper.php:43
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52