FlexForm syntax
Note
Read this section together with Core API and FlexForms to make this topic easier to understand.
FlexForms provide a way for editors to set values for plugins by providing a "form-within-a-form" in the backend.
FlexForms have 2 parts: a setup XML file with root <T3DataStructure> and an XML
document inside a field in the tt_content database table with root <T3FlexForms>.
The setup file consists of data structures containing TCA field information that
are used to generate the backend form. The XML document in the database is the TCA field
information plus the values entered by the editor in the backend form (saved there
by function \TYPO3\)
When creating the XML setup file there are some limitations:
- "unique" and "uniqueInPid" are not available
- configuration cannot be recursively nested.
- You cannot add, change or remove fields. You need to make a copy and then change the configuration in the copy.
- The charset will be the same as the current backend UTF-8. Make sure that the files use UTF-8.
type='inline'and types that point to other database tables are not allowed.
Changed in version 13.0
Since TYPO3 13.0,
type='select' (if using
foreign_) is not allowed and will raise an exception.
Note this only applies to FlexForm sections, not general
FlexForm usage. For details and migration see
Breaking: #102970 - No database relations in FlexForm container sections.
There are 2 types of elements in the XML setup file - array elements and value elements:
Array Elements
<meta>
- Element
- <meta> Contains definitions of how languages are handled in the form.
<[application tag]>
- Element
- The same as ['columns']['field name']['config'] in TCA fields.
<ROOT>
- Element
-
Sections in FlexForms are called sheets. Each sheet has a <ROOT> element. The <ROOT> element contains the following child (value) elements:
- Child elements
-
<sheetTitle>
<sheetDescription>
<sheetShortDescr>
Value Elements
<sheetTitle>
- Element
- <sheetTitle>
- Format
- plain text label or label reference with the title of the sheet.
<sheetDescription>
- Element
- <sheetDescription>
- Format
- plain text label or label reference with a description of the sheet shown in the FlexForm.
<sheetShortDescr>
- Element
- <sheetShortDescr>
- Format
- plain text label or label reference with a description of the sheet. The description is used in the tab-menu.
Sheets and FlexForms saved in the database
FlexForms consist of sheets. If there is only one sheet, the sheet element will be "sDEF" by default and there is no tab-menu. The tab-menu only exists if there is more than one sheet.
FlexForm data format, <T3FlexForms>
The structure of the XML is as follows:
<T3FlexForms>
- Element
-
<T3FlexForms> Document tag
- Child elements
-
<meta>
<data>
<meta>
- Element
- <meta> Meta data about the content, for example, information about which sheet is active.
<data>
- Element
-
<data> Contains the main data: sheets, language sections, fields and values.
- Child elements
- <sheet>
<sheets>
- Element
-
<sheets> Contains the data for each sheet (section) in the form. If there are no sheets, only a default sheet "<sDEF>" exists.
- Child elements
-
<sDEF>
<s_[sheet keys]>
<sDEF>
- Element
-
<sDEF> Each sheet contains elements for each language. The only child tag is the <lDEF> tag.
- Child elements
- <lDEF>
<lDEF>
- Element
-
<lDEF> Contains field content in each language.
- Child elements
- <[field name]>
<[field name]>
- Element
-
<[field name]> There is at least one element with the value <vDEF> for each field.
- Child elements
- <vDEF>
<vDEF>
- Element
- <vDEF>
- Format
- string Default or localized field content.