Link
The Link
type creates a field with a link wizard. It is possible to link
to pages, files or even records (if configured). This field is resolved to an
object of type \TYPO3\
.
Settings
default
-
- Type
- string
- Default
- ''
Default value set if a new record is created.
required
-
- Type
- boolean
- Default
- false
If set, the field becomes mandatory.
nullable
-
- Type
- boolean
- Default
- false
If set, the field value will resolve to
null
if no link is provided. Useful, if field is optional.
allowedTypes
-
- Type
- array
- Default
- '[*]'
Allow list of link types. Possible values are
page
,url
,file
,folder
,email
,telephone
andrecord
.
Example
Minimal
name: example/link
fields:
- identifier: url
type: Link
Advanced / use case
name: example/link
fields:
- identifier: url
type: Link
autocomplete: true
default: 'https://typo3.org'
allowedTypes:
- page
- url
- file
required: true
valuePicker:
items:
- [ 'TYPO3 CMS', 'https://www.typo3.org' ]
- [ 'TYPO3 GmbH', 'https://www.typo3.com' ]
Usage in Fluid
As this field is an object of type \TYPO3\
you have to check for the property url
to determine whether the field is
set or not.
Note
Alternatively, you can set the field nullable: true
. In this case
the value will resolve to null
if not set.
<f:if condition="{data.link_field.url}">
<f:link.typolink parameter="{data.link_field}">Link</f:link.typolink>
</f:if>