Radio buttons
New in version 13.0
When using the radio
type, TYPO3 takes care of
generating the according database field.
A developer does not need to define this field in an extension's
ext_
file.
This type creates a set of radio buttons. The value is typically stored as integer value, each radio item has one assigned number, but it can be a string, too.
The according database field is generated automatically.
Table of contents
Example: Set of radio buttons field
[
'columns' => [
'radio_1' => [
'label' => 'radio_1',
'description' => 'radio_1 three options, one without label',
'config' => [
'type' => 'radio',
'items' => [
[
'label' => 'foo',
'value' => 1,
],
[
'label' => '',
'value' => 2,
],
[
'label' => 'foobar',
'value' => 3,
],
],
],
],
],
]
Properties of the TCA column type radio
behaviour
-
allowLanguageSynchronization
-
- Type
- boolean
- Default
- false
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
- Scope
- Proc.
Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called
l10n_
. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.state
default
-
- Type
- string
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['default']
- Scope
- Display / Proc.
Default value set if a new record is created. If empty, no radio gets selected.
fieldControl
-
For details see fieldControl.
fieldInformation
-
For details see fieldInformation.
fieldWizard
-
defaultLanguageDifferences
-
- Type
- array
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']
For details see defaultLanguageDifferences.
otherLanguageContent
-
- Type
- array
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']
For details see otherLanguageContent.
items
-
- Type
- array
- Required
true
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']
- Scope
- Display / Proc.
An array of values which can be selected.
Each entry is in itself an associative array.
- label (string or LLL reference)
- The displayed title.
- value (integer or string)
- The value stored in the database.
itemsProcFunc
-
- Type
- string (class->method reference)
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']
- Scope
- Display / Proc.
- Example
- Example: Checkboxes with itemsProcFunc
PHP method which is called to fill or manipulate the items array. It is recommended to use the actual FQCN with
class
and then concatenate the method:\VENDOR\
Extension\ User Function\ Form Engine\ Your Class:: class . '->your Method' This becomes handy when using an IDE and doing operations like renaming classes.
The provided method will have an array of parameters passed to it. The items array is passed by reference in the key
items
. By modifying the array of items, you alter the list of items. A method may throw an exception which will be displayed as a proper error message to the user.Passed parametersitems
(passed by reference)config
(TCA config of the field)TSconfig
(The matching itemsProcFunc TSconfig)table
(current table)row
(current database record)field
(current field name)effective
(correct page ID)Pid site
(current site)
The following parameter only exists if the field has a flex parent.
flex
Parent Database Row
The following parameters are filled if the current record has an inline parent:
inline
Parent Uid inline
Parent Table Name inline
Parent Field Name inline
Parent Config inline
Top Most Parent Uid inline
Top Most Parent Table Name inline
Top Most Parent Field Name
readOnly
-
- Type
- boolean
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
- Scope
- Display
Renders the field in a way that the user can see the value but cannot edit it.
Warning
This property affects only the display. It is still possible to write to those fields when using the DataHandler.