Radio¶
type => 'radio' // TCA
The Radio
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.
Settings¶
-
default
¶ -
- Required
-
false
- Type
-
string|int
- Default
-
''
Default value set if a new record is created.
-
items
¶ -
- Required
-
true
- Type
-
array
Contains the radio items. Each item is an array with the keys
label
andvalue
. Values are usually integers, but can also be strings if desired.Example:
items: - label: 'First option' value: 0 - label: 'Second option' value: 1 - label: 'Third option' value: 2
Copied!XLF translation keys for items have the following convention:
<body> <trans-unit id="FIELD_IDENTIFIER.items.1.label"> <source>Label for item with value 1</source> </trans-unit> <trans-unit id="FIELD_IDENTIFIER.items.2.label"> <source>Label for item with value 2</source> </trans-unit> <trans-unit id="FIELD_IDENTIFIER.items.VALUE.label"> <source>Label for item with value VALUE</source> </trans-unit> <trans-unit id="FIELD_IDENTIFIER.items.label"> <source>Label for item with empty value</source> </trans-unit> </body>
Copied!
-
allowedCustomProperties
¶ -
- Required
-
false
- Type
-
array
- Default
-
["itemsProcConfig"]
Sometimes it is needed to provide custom configuration for the itemsProcFunc functionality. These extra properties need to be explicitly allowed via this option. This option receives an array of those strings. By default, the custom option
itemsProcConfig
is allowed.
For more advanced configuration refer to the TCA documentation.
Example¶
Minimal¶
name: example/radio
fields:
- identifier: radioboxes
type: Radio
items:
- label: 'First option'
value: 0
- label: 'Second option'
value: 1
Advanced / use case¶
name: example/radio
fields:
- identifier: radioboxes
type: Radio
default: 'one'
items:
- label: 'First option'
value: 'one'
- label: 'Second option'
value: 'two'
- label: 'Third option'
value: 'three'