17 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;
76 parent::initializeArguments();
77 $this->registerUniversalTagAttributes();
78 $this->registerTagAttribute(
'target',
'string',
'Target of link',
false);
79 $this->registerTagAttribute(
'rel',
'string',
'Specifies the relationship between the current document and the linked document',
false);
80 $this->registerArgument(
'pageUid',
'int',
'Target page. See TypoLink destination');
81 $this->registerArgument(
'pageType',
'int',
'Type of the target page. See typolink.parameter');
82 $this->registerArgument(
'noCache',
'bool',
'Set this to disable caching for the target page. You should not need this.');
83 $this->registerArgument(
'noCacheHash',
'bool',
'Set this to suppress the cHash query parameter created by TypoLink. You should not need this.');
84 $this->registerArgument(
'section',
'string',
'The anchor to be added to the URI');
85 $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.');
86 $this->registerArgument(
'additionalParams',
'array',
'Additional query parameters that won\'t be prefixed like $arguments (overrule $arguments)');
87 $this->registerArgument(
'absolute',
'bool',
'If set, the URI of the rendered link is absolute');
88 $this->registerArgument(
'addQueryString',
'bool',
'If set, the current query parameters will be kept in the URI');
89 $this->registerArgument(
'argumentsToBeExcludedFromQueryString',
'array',
'Arguments to be removed from the URI. Only active if $addQueryString = TRUE');
90 $this->registerArgument(
'addQueryStringMethod',
'string',
'Set which parameters will be kept. Only active if $addQueryString = TRUE');
98 $pageUid = isset($this->arguments[
'pageUid']) ? (int)$this->arguments[
'pageUid'] :
null;
99 $pageType = isset($this->arguments[
'pageType']) ? (int)$this->arguments[
'pageType'] : 0;
100 $noCache = isset($this->arguments[
'noCache']) ? (bool)$this->arguments[
'noCache'] :
false;
101 $noCacheHash = isset($this->arguments[
'noCacheHash']) ? (bool)$this->arguments[
'noCacheHash'] :
false;
102 $section = isset($this->arguments[
'section']) ? (string)$this->arguments[
'section'] :
'';
103 $linkAccessRestrictedPages = isset($this->arguments[
'linkAccessRestrictedPages']) ? (bool)$this->arguments[
'linkAccessRestrictedPages'] :
false;
104 $additionalParams = isset($this->arguments[
'additionalParams']) ? (array)$this->arguments[
'additionalParams'] : [];
105 $absolute = isset($this->arguments[
'absolute']) ? (bool)$this->arguments[
'absolute'] :
false;
106 $addQueryString = isset($this->arguments[
'addQueryString']) ? (bool)$this->arguments[
'addQueryString'] :
false;
107 $argumentsToBeExcludedFromQueryString = isset($this->arguments[
'argumentsToBeExcludedFromQueryString']) ? (array)$this->arguments[
'argumentsToBeExcludedFromQueryString'] : [];
108 $addQueryStringMethod = $this->arguments[
'addQueryStringMethod'] ??
null;
109 $uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder();
110 $uri = $uriBuilder->reset()
111 ->setTargetPageUid($pageUid)
112 ->setTargetPageType($pageType)
113 ->setNoCache($noCache)
114 ->setUseCacheHash(!$noCacheHash)
115 ->setSection($section)
116 ->setLinkAccessRestrictedPages($linkAccessRestrictedPages)
117 ->setArguments($additionalParams)
118 ->setCreateAbsoluteUri($absolute)
119 ->setAddQueryString($addQueryString)
120 ->setArgumentsToBeExcludedFromQueryString($argumentsToBeExcludedFromQueryString)
121 ->setAddQueryStringMethod($addQueryStringMethod)
123 if ((
string)$uri !==
'') {
124 $this->tag->addAttribute(
'href', $uri);
125 $this->tag->setContent($this->renderChildren());
126 $this->tag->forceClosingTag(
true);
127 $result = $this->tag->render();
129 $result = $this->renderChildren();