Attention
TYPO3 v11 has reached end-of-life as of October 31th 2024 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v10 here: TYPO3 ELTS.
selectCheckBox and type check fields compared
There is a subtle difference between select fields with the render type selectCheckBox and fields of the type check:
Select values from a checkbox list
The select checkbox stores the values as comma separated values.
[
'columns' => [
'select_checkbox_3' => [
'exclude' => 1,
'label' => 'select_checkbox_3 icons, description',
'config' => [
'type' => 'select',
'renderType' => 'selectCheckBox',
'items' => [
[
'foo 1',
1,
'',
null,
[
'title' => 'optional title',
'description' => 'optional description',
],
],
[
'foo 2',
2,
'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
null,
'LLL:EXT:styleguide/Resources/Private/Language/locallang.xlf:translatedHelpTextForSelectCheckBox3',
],
[
'foo 3',
3,
'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
],
[
'foo 4',
4,
],
],
],
],
],
]
The field in the database is of type text or varchar.
Select values from a checkbox list
On the contrary the type check saves multiple values
as bits. Therefore if the first value is chosen it stores 1
, if only the
second is chosen it stores 2
and if both are chosen 3
.
[
'columns' => [
'checkbox_3' => [
'exclude' => 1,
'label' => 'checkbox_3',
'description' => 'three checkboxes, two with labels, one without',
'config' => [
'type' => 'check',
'items' => [
[
'foo',
],
[
'',
],
[
0 => 'foobar',
'iconIdentifierChecked' => 'content-beside-text-img-below-center',
'iconIdentifierUnchecked' => 'content-beside-text-img-below-center',
],
],
],
],
],
]
The field in the database is of type int.