Data structure (ds)

ds
Path

$GLOBALS['TCA'][$table]['columns'][$field]['config']

type

array

Scope

Display / Proc.

Data Structure(s) defined in an array.

Each key is a value that can be pointed to by ds_pointerField. Default key is "default" which is what you should use if you do not have a ds_pointerField value of course.

If you specified more than one ds_pointerField, the keys in this "ds" array should contain comma-separated value pairs where the asterisk * matches all values (see the example below). If you don't need to switch for the second ds_pointerField, it's also possible to use only the first ds_pointerField's value as a key in the "ds" array without necessarily suffixing it with ",*" for a catch-all on the second ds_pointerField.

For each value in the array there are two options:

  • Make a reference to an external XML file
  • Either enter XML directly

Examples

Example with XML in external file

EXT: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' => [
                    'default' => '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 entered

EXT:styleguide/Configuration/TCA/tx_styleguide_flex.php
[
    'columns' => [
        'flex_2' => [
            'label' => 'flex_2 section container',
            'config' => [
                'type' => 'flex',
                'ds' => [
                    'default' => '
                        <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>
                            </sheets>
                        </T3DataStructure>
                    ',
                ],
            ],
        ],
    ],
]
Copied!