Using FlexForms
Basically the configuration of a FlexForm field is all about pointing to a data structure which contains the form rendering information.
For general information about the backbone of a Data Structure, please refer to the "<T3DataStructure>" chapter in the Core API manual.
Using FlexForms to configure plugins
FlexForms are commonly used in the tt_
table to register plugins.
Deprecated since version 14.0
Using Extension
has been deprecated,
use the 7th parameter of Extension
instead.
New in version 14.0
FlexForm definitions can be passed as the 7th parameter to
Extension
when registering Extbase.
Configuring a table with a FlexForm
Changed in version 14.0
See Breaking: #107047 - Remove pointer field functionality of TCA flex for migration.
Use configuration option ds to either pass a file reference to the XML file containing the FlexForm or a string containing the FlexForm's XML:
[
'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',
],
],
],
]
Essentially: Whenever a record is handled that has a column field
definition with this TCA, the data structure defined in
FILE:
is parsed and the flex form defined in there is displayed.
Individual FlexForms by type
Changed in version 14.0
See Breaking: #107047 - Remove pointer field functionality of TCA flex for migration.
If the table has $GLOBALS['TCA'][$table]['ctrl']['type'] set, you can use columnsOverrides to set different FlexForms by type.
<?php
return [
'ctrl' => [
'title' => 'Table with special FlexForm per Type',
'type' => 'my_type_field',
'label' => 'uid',
],
'columns' => [
'my_type_field' => [
// ...
],
'pi_flexform' => [
'config' => [
// FlexFormDefault.xml is used if not overridden in the columnsOverrides
'ds' => 'FILE:EXT:news/Configuration/FlexFormDefault.xml',
],
],
],
'types' => [
0 => [
'showitem' => 'my_type_field, pi_flexform',
],
1 => [
'showitem' => 'my_type_field, pi_flexform',
'columnsOverrides' => [
'pi_flexform' => [
'config' => [
'ds' => 'FILE:EXT:news/Configuration/FlexForm1.xml',
],
],
],
],
2 => [
'showitem' => 'my_type_field, pi_flexform',
'columnsOverrides' => [
'pi_flexform' => [
'config' => [
'ds' => 'FILE:EXT:news/Configuration/FlexForm2.xml',
],
],
],
],
3 => [
'showitem' => 'my_type_field, pi_flexform',
],
],
];
In the above example, type 0 and type 3 display the default FlexForm defined in
file 'FILE:
, and type 1 and 2
each display their individual FlexForms.