Core API
4.2.7. ['columns'][fieldname]['config'] / TYPE: "check"
This type creates checkbox(es). Such elements might look like this:

You can also configure checkboxes to appear in an array:

You can have between 1 and 10 checkboxes and the field type in the database must be an integer. No matter how many checkboxes you have each check box will correspond to a single bit in the integer value. Even if there is only one checkbox (which in turn means that you should theoretically check the bit-0 of values from single-checkbox fields and not just whether it is true or false!).
|
Key |
Datatype |
Description |
Scope |
|---|---|---|---|
|
type |
string |
[Must be set to "check"] |
Display / Proc. |
|
items |
array |
If set, this array will create an array of checkboxes instead of just a single "on/off" checkbox.
Notice: You can have a maximum of 10 checkboxes in such an array and each element is represented by a single bit in the integer value which ultimately goes into the database.
In this array each entry is itself an array where the first entry is the label (LS) and the second entry is a blank value. The value sent to the database will be an integer where each bit represents the state of a checkbox in this array.
Example:
'items' => Array ( Array('Green tomatoes', ''), Array('Red peppers', '') ), |
Display |
|
cols |
integer |
How many columns the checkbox array are shown in. Range is 1-10, 1 being default.
(Makes sense only if the 'array' key is defining a checkbox array) |
Display |
|
showIfRTE |
boolean |
If set, this field will show only if the RTE editor is enabled (which includes correct browserversion and user-rights altogether.) |
Display |
|
default |
integer |
Setting the default value of the checkbox(es).
Notice: Each bit corresponds to a check box (even if only one checkbox which maps to bit-0). |
Display / Proc. |
|
itemsProcFunc |
string (function reference) |
PHP function which is called to fill / manipulate the array with elements.
The function/method will have an array of parameters passed to it (where the item-array is passed by reference in the key 'items'). By modifying the array of items, you alter the list of items. For more information, see how user-functions are specified in the section about 'wizards' some pages below here. |
Display |
Now follows some codelistings as examples:
Example: A single checkbox
A totally unfancy checkbox:
'personal' => Array (
'label' => 'LLL:EXT:sys_note/locallang_tca.php:sys_note.personal',
'config' => Array (
'type' => 'check'
)
)
Example: A checkbox array
This is an example of a checkbox array with two checkboxes in it. The first checkbox will have bit-0 and the second bit-1. The default value is set to '3' which means that each checkbox will be enabled by default (since the value three contains both bit-0 and bit-1):
'sendOptions' => Array (
'label' => 'LLL:EXT:direct_mail/locallang_tca.php:sys_dmail.sendOptions',
'config' => Array (
'type' => 'check',
'items' => Array (
Array('LLL:EXT:direct_mail/locallang_tca.php:sys_dmail.sendOptions.I.0', ''),
Array('LLL:EXT:direct_mail/locallang_tca.php:sys_dmail.sendOptions.I.1', '')
),
'default' => '3'
)
),
