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.
default
default
-
- Type
- integer
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']
- Scope
- Display / Proc.
The default value of the checkbox(es).
Each bit of the decimal value corresponds to a checkbox. As an example, the value
5
enables the first and third checkbox.This is true even if there is only one checkbox, which then maps to the first bit (reading from right to left).
decimal value binary representation selected checkboxes 0 0000 0000 none 1 0000 0001 first 2 0000 0010 second 5 0000 0101 first, third 127 0111 1111 the first seven To find out the right default decimal value, first start off by writing down the binary representation and set the desired bits at the appropriate position to 1. Then convert the binary number to decimal. You can either use a calculator with programmer mode or search online for "binary to decimal".
Examples
Multiple checkboxes with a default value
Here "Tu", the second bit, is active by default.
'columns' => [
'checkbox_16' => [
'exclude' => 1,
'label' => 'checkbox_16',
'description' => 'cols=inline',
'config' => [
'type' => 'check',
'default' => 2,
'items' => [
['Mo', ''],
['Tu', ''],
['We', ''],
['Th', ''],
['Fr', ''],
['Sa', ''],
['Su', ''],
],
'cols' => 'inline',
],
],
]