FlexForm¶
The FlexForm
field allows to group multiple fields into one database column.
It is mostly used to store configuration options, rather than actual content.
By using FlexForm it is possible to conserve the database, but it also has its
limitations. For example nesting of Collections is disallowed.
It corresponds with the TCA type => 'flex'
.
SQL overrides via alternativeSql
allowed: no.
Settings¶
-
fields
¶ Required: true Type: array Similar to
Collections
you define the fields to be used inside the FlexForm definition.
Sheets¶
Sheets are used to further group FlexForm fields into separate tabs. This is
done by defining the type Sheet
, which itself can hold further
fields
. It is mandatory to define an identifier
for the Sheet.
See the advanced example on how to use it. Note that you need at
least 2 Sheets for a tab navigation to appear in the backend. This is purely
cosmetical and, like Palettes and Tabs, has no effect on Frontend rendering.
Warning
Due to the fact that FlexForm is stored as XML in the database, changing the Sheet identifiers (or moving fields into other Sheets) retrospectively is destructive. You will lose your data.
Labels¶
Labels for Sheets have the following convention:
<FlexFormIdentifier>.sheets.<SheetIdentifier>.label
<FlexFormIdentifier>.sheets.<SheetIdentifier>.description
<FlexFormIdentifier>.sheets.<SheetIdentifier>.linkTitle (link title of the tabs)
Sections¶
Sections are like Collections for FlexForm. The difference is, that you can’t
reference foreign types. Instead you define anonymous structures, which are only
available for this specific FlexForm field. They also require you to set the
type Section
and a unique identifier
. Inside a Section, you
define the key container
, which contains a list of containers. It is
required to have at least one container. A container has two required keys:
again identifier
and fields
. A type must not be set, as it is
the only allowed type inside sections. Not allowed types inside container
are: FlexForm
, File
, Collection
, Sheet
and
Section
.
Labels¶
Labels for Sections, Container and fields inside Container have the following convention:
<FlexFormIdentifier>.sections.<sectionIdentifier>.label
<FlexFormIdentifier>.sections.<sectionIdentifier>.container.<containerIdentifier>.label
<FlexFormIdentifier>.sections.<sectionIdentifier>.container.<containerIdentifier><fieldIdentifier>.label
Examples¶
Minimal¶
name: example/flex
group: common
fields:
- identifier: my_flexform
type: FlexForm
fields:
- identifier: header
type: Text
- identifier: check
type: Checkbox
With Sheets¶
name: example/flex
group: common
fields:
- identifier: my_flexform
type: FlexForm
fields:
- identifier: sheet1
type: Sheet
fields:
- identifier: header
type: Text
- identifier: check
type: Checkbox
- identifier: sheet2
type: Sheet
fields:
- identifier: link
type: Link
- identifier: radio
type: Radio
With Sections and Container¶
name: cbteam/flexform
group: common
fields:
- identifier: pi_flexform
useExistingField: true
fields:
- type: Sheet
identifier: sheet1
fields:
- identifier: link1
type: Link
- identifier: section1
type: Section
container:
- identifier: container1
fields:
- identifier: container_field
type: Text
- identifier: container2
fields:
- identifier: container_field2
type: Textarea
- type: Sheet
identifier: sheet2
fields:
- identifier: header2
type: Text
- identifier: textarea2
type: Textarea
- identifier: header1
type: Text