FlexForm field
New in version 13.0
When using the flex
type, TYPO3 takes care of
generating the according database field.
A developer does not need to define this field in an extension's
ext_
file.
Renders a FlexForm element. Essentially, this consists in a hierarchically organized set of fields which will have their values saved into a single field in the database, stored as XML.
The according database field is generated automatically.
The general idea is: There is a data structure that defines which and how single fields should be displayed, re-using all the TCA column type possibilities. The actual values of single fields are then stored in an XML representation within this "flex" field.
Table of contents:
Properties of the TCA column type flex
Changed in version 13.0
The configuration options ds_
, ds_
and ds_
are not handled anymore. Use the
Events to replace their logic if needed.
Name | Type | Scope |
---|---|---|
boolean | Proc. | |
string | Display / Proc. | |
array | ||
array | ||
array | ||
boolean | Display | |
boolean | Display |
behaviour
-
allowLanguageSynchronization
-
- Type
- boolean
- Default
- false
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
- Scope
- Proc.
Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called
l10n_
. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.state EXT:my_extension/Configuration/TCA/Overrides/someTable.php
ds
-
- Type
- string
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']
- Scope
- Display / Proc.
Changed in version 14.0
- Multiple entries are no longer supported. Instead use
- columnsOverrides.
See Breaking: #107047 - Remove pointer field functionality of TCA flex for migration.
This field can either contain a file reference to the file containing the FlexForm's XML (
'ds' => 'FILE:
) or contain the XML content directly (EXT: news/ Configuration/ Flex Form. xml' 'ds' => '<T3Data
).Structure>...' Example with XML in external fileEXT:styleguide/Configuration/TCA/tx_styleguide_flex.php[ 'columns' => [ 'flex_file_1' => [ 'label' => 'flex_file_1 simple flexform in external file', 'description' => 'field description', 'config' => [ 'type' => 'flex', 'ds' => 'FILE:EXT:styleguide/Configuration/FlexForms/Simple.xml', ], ], ], ]
Copied!The included file:
<T3DataStructure> <sheets> <sDEF> <ROOT> <sheetTitle>Sheet Title</sheetTitle> <type>array</type> <el> <input_1> <label>input_1</label> <config> <type>input</type> </config> </input_1> </el> </ROOT> </sDEF> </sheets> </T3DataStructure>
Copied!Example with XML directly enteredEXT:styleguide/Configuration/TCA/tx_styleguide_flex.php[ 'columns' => [ 'flex_2' => [ 'label' => 'flex_2 section container', 'config' => [ 'type' => 'flex', 'ds' => ' <T3DataStructure> <sheets> <sSection> <ROOT> <sheetTitle>section</sheetTitle> <type>array</type> <el> <section_1> <title>section_1</title> <type>array</type> <section>1</section> <el> <container_1> <type>array</type> <title>container_1</title> <el> <input_1> <label>input_1 description</label> <description>field description</description> <config> <type>input</type> </config> </input_1> <color_1> <label>color_1</label> <config> <type>color</type> <size>10</size> </config> </color_1> </el> </container_1> <container_2> <type>array</type> <title>container_2</title> <el> <text_1> <label>text_1 default "foo"</label> <config> <type>text</type> <default>foo</default> </config> </text_1> </el> </container_2> </el> </section_1> </el> </ROOT> </sSection> <sSection2> <ROOT> <sheetTitle>section2</sheetTitle> <type>array</type> <el> <section_2> <title>section_2</title> <type>array</type> <section>1</section> <el> <container_1> <type>array</type> <title>container_1</title> <el> <input_1> <label>input_1 description</label> <description>field description</description> <config> <type>input</type> </config> </input_1> <color_1> <label>color_1</label> <config> <type>color</type> <size>10</size> </config> </color_1> </el> </container_1> <container_2> <type>array</type> <title>container_2</title> <el> <text_1> <label>text_1 default "foo"</label> <config> <type>text</type> <default>foo</default> </config> </text_1> </el> </container_2> </el> </section_2> </el> </ROOT> </sSection2> </sheets> </T3DataStructure> ', ], ], ], ]
Copied!
Changed in version 14.0
Option ds_
has been removed. Use
ds in
combination with columnsOverrides.
See Breaking: #107047 - Remove pointer field functionality of TCA flex for migration.
fieldInformation
-
For details see fieldInformation.
fieldWizard
-
defaultLanguageDifferences
-
- Type
- array
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']
For details see defaultLanguageDifferences.
localizationStateSelector
-
- Type
- array
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']
For details see localizationStateSelector.
otherLanguageContent
-
- Type
- array
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']
For details see otherLanguageContent.
readOnly
-
- Type
- boolean
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
- Scope
- Display
Renders the field in a way that the user can see the value but cannot edit it.
Warning
This property affects only the display. It is still possible to write to those fields when using the DataHandler.
searchable
-
- Type
- boolean
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['searchable']
- Scope
- Display
- Default
true
New in version 14.0
TYPO3 now automatically includes all fields of suitable types in backend search operations in the List module.
This option can be used to explicitly exclude fields from being searchable, instead of having to list them in the now removed option $GLOBALS['TCA'][$table]['ctrl']['searchFields'].
By default, all fields of type
flex
are considered searchable. To exclude a field from being searchable, set the following in the field's TCA configuration:packages/my_extension/Configuration/TCA/Overrides/tx_my_table.php$GLOBALS['TCA']['tx_my_table']['columns']['my_field'] = [ 'label' => 'My field', 'config' => [ 'type' => 'flex', 'searchable' => false, ], ];
Copied!
Defining multiple data structures for different records
There can be multiple data structures defined in TCA
and which one is chosen
depends on the configuration and the record . You can use
ds or Events to manipulate
which data structure should be displayed.
Note
It is not possible to override these properties in
TCA type columnsOverrides or to manipulate
them in an inline parent-child relation from the parent TCA
.
Events to manipulate the FlexForm data structure
There are appropriate events that allow the manipulation of the data structure lookup logic: