TYPO3 Logo
Content Blocks
Release: 1.0

Loading data.

  • Introduction
  • Installation
  • Definition
    • config.yaml
    • assets
    • templates
    • language
  • Registration
  • Commands
    • Kickstart command
    • List command
    • Language Generate command
  • YAML reference
    • Common root options
    • Content Elements
    • Page Types
    • Record Types
    • Field types
      • Basic
      • Category
      • Checkbox
      • Collection
      • Color
      • DateTime
      • Email
      • File
      • FlexForm
        • Sheet
        • Section
      • Folder
      • Json
      • Language
      • Linebreak
      • Link
      • Number
      • Palette
      • Pass
      • Password
      • Radio
      • Relation
      • Select
      • Slug
      • Tab
      • Text
      • Textarea
      • Uuid
    • Basics (Mixins)
  • Templating
  • Guides
    • Adding new groups
    • Extend TCA
    • Extend TypoScript
    • Fluid Styled Content Layouts
    • Nested Content Elements
    • Installation without Fluid Styled Content
    • Page Types
    • Record Types
    • Reuse existing fields
    • Shared Partials
  • Developer corner
    • Extending Field Types
  • Migrations
    • Content Blocks for v12
    • Mask
  • Known Problems
  • Appendix
    • Core Content Types
    • TCA type mapping
    • History
  • Sitemap

Contributors Corner

  • View source of current document
  • How to edit
  • Edit current document on GitHub
  1. TYPO3 Content Blocks
  2. YAML reference
  3. Field types
  4. Link
Report issue View source How to edit Edit on GitHub

Link

type => 'link' // TCA

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\CMS\Core\LinkHandling\TypolinkParameter .

Settings

default

default
Required

false

Type

string

Default

''

Default value set if a new record is created.

required

required
Required

false

Type

boolean

Default

false

If set, the field becomes mandatory.

nullable

nullable
Required

false

Type

boolean

Default

false

If set, the field value will resolve to null if no link is provided. Useful, if field is optional.

allowedTypes

allowedTypes
Required

false

Type

array

Default

'[*]'

Allow list of link types. Possible values are page, url, file, folder, email, telephone and record.

For more advanced configuration refer to the TCA documentation.

Example

Minimal

name: example/link
fields:
  - identifier: url
    type: Link
Copied!

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' ]
Copied!

Usage in Fluid

As this field is an object of type \TYPO3\CMS\Core\LinkHandling\TypolinkParameter 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>
Copied!
  • Previous
  • Next
Reference to the headline

Copy and freely share the link

This link target has no permanent anchor assigned. You can make a pull request on GitHub to suggest an anchor. The link below can be used, but is prone to change if the page gets moved.

Copy this link into your TYPO3 manual.

  • Home
  • Contact
  • Issues
  • Repository

Last rendered: Nov 12, 2024 12:03

© since 2023 by TYPO3 contributors
  • Legal Notice
  • Privacy Policy