items¶
-
items
¶ -
- Type
- array
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']
- Scope
- Display / Proc.
- RenderType
- all
Contains the elements for the selector box unless the property
foreign_table
orspecial
has been set in which case automated values are set in addition to any values listed in this array.Changed in version 13.0
Auto-registration of New content element wizard via TCA introduced. If your extension supports both TYPO3 v12 and v13, keep the page TSconfig option newContentElement.wizardItems until dropping TYPO3 v12 support.
Items registered for the field
CType
of tablett_content
get automatically added to the New content element wizard. Settings from the items property can be overridden via page TSconfig newContentElement.wizardItems.See also Add content elements to the Content Element Wizard.
Deprecated since version 12.3
Using the numerical indexes 0 - 4 is deprecated. Use the newly introduced keys.
Each element in this array is in itself an associative array.
- label (string or LLL reference)
- The displayed title.
- value (integer or string)
-
The value stored in the database.
- The special value
--div--
was used to insert a non-selectable - value that appears as a divider label in the selector box. It is kept for backwards-compatible reasons. Use item groups for custom selects instead.
- The special value
- Values must not contain
,
(comma) and|
(vertical bar). If you want to useauthMode
, you should - also refrain from using
:
(colon).
- Values must not contain
- icon (EXT: path or icon identifier)
- Optional icon. For custom icons use a path prepended with
EXT:
to refer to an image file found inside an extension or use an registered icon identifier. If configured on theforeign_table
, selicon-field is respected. - group (string)
- The key of the item group.
- description (string or array)
- Fifth value is an optional description text. This is only shown when the list is shown
with
renderType='selectCheckBox'
.
Note
When having a zero as value
and the field is of type int(10)
in the database, make sure to define
the default value as well in TCA: 'default' => 0
. Otherwise
issues may arise, e.g. with MySQL strict mode.
Examples¶
Simple items definition with label and value¶
[
'columns' => [
'select_single_1' => [
'label' => 'select_single_1 two items, long text description',
'description' => 'field description',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
[
'label' => 'foo and this here is very long text that maybe does not really fit into the form in one line. Ok let us add even more text to see how this looks like if wrapped. Is this enough now? No? Then let us add some even more useless text here!',
'value' => 1,
],
[
'label' => 'bar',
'value' => 'bar',
],
],
],
],
],
]
Items definition with label, value and icon¶
A more complex example could be this (includes icons):
[
'columns' => [
'select_single_4' => [
'label' => 'select_single_4 items with icons',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
[
'label' => 'foo 1',
'value' => 'foo1',
'icon' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
],
[
'label' => 'foo 2',
'value' => 'foo2',
'icon' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
],
],
],
],
],
]
A typical sys_language_uid field¶
The icons can also be referenced by their identifier in the Icon API
[
'columns' => [
'sys_language_uid' => [
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language',
'config' => [
'type' => 'language',
],
],
],
]
Select checkbox field with icons and descriptions¶
Descriptions are only displayed in render type selectCheckbox
.
[
'columns' => [
'select_checkbox_3' => [
'label' => 'select_checkbox_3 icons, description',
'config' => [
'type' => 'select',
'renderType' => 'selectCheckBox',
'items' => [
[
'label' => 'foo 1',
'value' => 1,
'description' => [
'title' => 'optional title',
'description' => 'optional description',
],
],
[
'label' => 'foo 2',
'value' => 2,
'icon' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
'description' => 'LLL:EXT:styleguide/Resources/Private/Language/locallang.xlf:translatedHelpTextForSelectCheckBox3',
],
[
'label' => 'foo 3',
'value' => 3,
'icon' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
],
[
'label' => 'foo 4',
'value' => 4,
],
],
],
],
],
]
SelectSingle field with itemGroups¶
A select single field of size 6 with 3 item groups and one item without group.
[
'columns' => [
'select_single_17' => [
'label' => 'select_single_16',
'description' => 'itemGroups, size=6',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
[
'label' => 'item 1',
'value' => 1,
'group' => 'group1',
],
[
'label' => 'item 2',
'value' => 2,
'group' => 'group1',
],
[
'label' => 'item 3',
'value' => 3,
'group' => 'group3',
],
[
'label' => 'item 4',
'value' => 3,
],
],
'itemGroups' => [
'group1' => 'Group 1 with items',
'group2' => 'Group 2 with no items',
'group3' => 'Group 3 with items',
],
'size' => 6,
],
],
],
]