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>
Copied!
Output:
<a href="/page/path/name.html?X=y" title="testtitle with whitespace" target="_blank">
Linktext
</a>
Copied!
Depending on current page, routing and page path configuration.
TextWrap usage
<f:link.typolink parameter="123" textWrap="<span>|</span>"/>
Copied!
Output:
<a href="/some/page">
<span>Page title of some page wrapped in span</span>
</a>
Copied!
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>
Copied!
Output:
<a href="/page/path/name.html?X=y&u=b" title="some title" target="_blank" class="ico-class" type="button">
Linktext
</a>
Copied!
Depending on routing and page path configuration.
Source code
Go to the source code of this ViewHelper: Link\TypolinkViewHelper.php (GitHub).
Arguments
The following arguments are available for the link.typolink ViewHelper:
absolute
-
- Type
- bool
- Default
- false
Ensure the resulting URL is an absolute URL
addQueryString
-
- Type
- string
- Default
- false
If set, the current query parameters will be kept in the URL. If set to "untrusted", then ALL query parameters will be added. Be aware, that this might lead to problems when the generated link is cached.
addQueryStringExclude
-
- Type
- string
- Default
- ''
Define parameters to be excluded from the query string (only active if addQueryString is set)
additionalAttributes
-
- Type
- array
- Default
- array ( )
Additional tag attributes to be added directly to the resulting HTML tag
additionalParams
-
- Type
- string
- Default
- ''
Additional query parameters to be attached to the resulting URL
class
-
- Type
- string
- Default
- ''
Define classes 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
parameter
-
- Type
- mixed
- Required
- 1
stdWrap.typolink style parameter string
parts-as
-
- Type
- string
- Default
- 'typoLinkParts'
Variable name containing typoLink parts (if any)
target
-
- Type
- string
- Default
- ''
Define where to display the linked URL
textWrap
-
- Type
- string
- Default
- ''
Wrap the link using the typoscript "wrap" data type
title
-
- Type
- string
- Default
- ''
Define the title for the link element