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.
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_select.php¶
[
'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
.
EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php¶
[
'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.