TYPO3 CMS  TYPO3_8-7
PageViewHelper.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
18 
49 {
51 
55  public function initializeArguments()
56  {
57  parent::initializeArguments();
58  $this->registerArgument('pageUid', 'int', 'target PID');
59  $this->registerArgument('additionalParams', 'array', 'query parameters to be attached to the resulting URI', false, []);
60  $this->registerArgument('pageType', 'int', 'type of the target page. See typolink.parameter', false, 0);
61  $this->registerArgument('noCache', 'bool', 'set this to disable caching for the target page. You should not need this.', false, false);
62  $this->registerArgument('noCacheHash', 'bool', 'set this to suppress the cHash query parameter created by TypoLink. You should not need this.', false, false);
63  $this->registerArgument('section', 'string', 'the anchor to be added to the URI', false, '');
64  $this->registerArgument('linkAccessRestrictedPages', 'bool', 'If set, links pointing to access restricted pages will still link to the page even though the page cannot be accessed.', false, false);
65  $this->registerArgument('absolute', 'bool', 'If set, the URI of the rendered link is absolute', false, false);
66  $this->registerArgument('addQueryString', 'bool', 'If set, the current query parameters will be kept in the URI', false, false);
67  $this->registerArgument('argumentsToBeExcludedFromQueryString', 'array', 'arguments to be removed from the URI. Only active if $addQueryString = TRUE', false, []);
68  $this->registerArgument('addQueryStringMethod', 'string', 'Set which parameters will be kept. Only active if $addQueryString = TRUE');
69  }
70 
77  public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
78  {
79  $pageUid = $arguments['pageUid'];
80  $additionalParams = $arguments['additionalParams'];
81  $pageType = $arguments['pageType'];
82  $noCache = $arguments['noCache'];
83  $noCacheHash = $arguments['noCacheHash'];
84  $section = $arguments['section'];
85  $linkAccessRestrictedPages = $arguments['linkAccessRestrictedPages'];
86  $absolute = $arguments['absolute'];
87  $addQueryString = $arguments['addQueryString'];
88  $argumentsToBeExcludedFromQueryString = $arguments['argumentsToBeExcludedFromQueryString'];
89  $addQueryStringMethod = $arguments['addQueryStringMethod'];
90 
91  $uriBuilder = $renderingContext->getControllerContext()->getUriBuilder();
92  $uri = $uriBuilder->setTargetPageUid($pageUid)->setTargetPageType($pageType)->setNoCache($noCache)->setUseCacheHash(!$noCacheHash)->setSection($section)->setLinkAccessRestrictedPages($linkAccessRestrictedPages)->setArguments($additionalParams)->setCreateAbsoluteUri($absolute)->setAddQueryString($addQueryString)->setArgumentsToBeExcludedFromQueryString($argumentsToBeExcludedFromQueryString)->setAddQueryStringMethod($addQueryStringMethod)->build();
93  return $uri;
94  }
95 }
static renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)