Attention
TYPO3 v11 has reached end-of-life as of October 31th 2024 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v11 here: TYPO3 ELTS.
Link.typolink ViewHelper <f:link.typolink>
A ViewHelper to create links from fields supported by the link wizard
Example
{link}
contains: t3://page?uid=2&arg1=val1#9 _blank some-css-class "Title containing Whitespace"
.
Or a legacy version from older TYPO3 versions:
{link}
contains: 9 _blank - "testtitle with whitespace" &X=y
.
Minimal usage
<f:link.typolink parameter="{link}">
Linktext
</f:link.typolink>
Output:
<a href="/page/path/name.html?X=y" title="testtitle with whitespace" target="_blank">
Linktext
</a>
Depending on current page, routing and page path configuration.
TextWrap usage
<f:link.typolink parameter="123" textWrap="<span>|</span>"/>
Output:
<a href="/some/page">
<span>Page title of some page wrapped in span</span>
</a>
Depending on current page, routing and page path configuration.
Full parameter usage
<f:link.typolink parameter="{link}" additionalParams="&u=b"
target="_blank"
class="ico-class" title="some title"
additionalAttributes="{type:'button'}"
>
Linktext
</f:link.typolink>
Output:
<a href="/page/path/name.html?X=y&u=b" title="some title" target="_blank" class="ico-class" type="button">
Linktext
</a>
Depending on routing and page path configuration.
Source code
Go to the source code of this ViewHelper: TypolinkViewHelper.php (GitHub).
Arguments
The following arguments are available for <f:
:
parameter
-
- Type
- string
- Required
true
StdWrap.typolink style parameter string
target
-
- Type
- string
Define where to display the linked URL
class
-
- Type
- string
Define classes for the link element
title
-
- Type
- string
Define the title for the link element
language
-
- Type
- string
Link to a specific language - defaults to the current language, use a language ID or "current" to enforce a specific language
additionalParams
-
- Type
- string
Additional query parameters to be attached to the resulting URL
additionalAttributes
-
- Type
- mixed
- Default
array
()
Additional tag attributes to be added directly to the resulting HTML tag
addQueryString
-
- Type
- boolean
If set, the current query parameters will be kept in the URL
addQueryStringMethod
-
- Type
- string
This argument is not evaluated anymore and will be removed in TYPO3 v12.
addQueryStringExclude
-
- Type
- string
Define parameters to be excluded from the query string (only active if addQueryString is set)
absolute
-
- Type
- boolean
Ensure the resulting URL is an absolute URL
parts-as
-
- Type
- string
- Default
'typo
Link Parts'
Variable name containing typoLink parts (if any)
textWrap
-
- Type
- string
Wrap the link using the typoscript "wrap" data type