Radio
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
| Name | Type | Default | Required |
|---|---|---|---|
| string|int | '' | ||
| array | true | ||
| boolean | false | ||
| object | |||
| object | |||
| object | |||
| object | |||
| string | |||
| object | |||
| boolean | false |
default
-
- Type
- string|int
- Default
- ''
Default value set if a new record is created.
items
-
- Type
- array
- Required
true
Contains the radio items. Each item is an array with the keys
labelandvalue. 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: 2Copied!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
itemsis allowed.Proc Config
behaviour.allowLanguageSynchronization
-
- Type
- boolean
- Default
- false
Allows to select if localization uses custom or default language value.
fieldControl
-
- Type
- object
See TCA fieldControl.
fieldInformation
-
- Type
- object
See TCA fieldInformation.
fieldWizard
-
- Type
- object
See TCA fieldWizard.
itemsProcessors
-
- Type
- object
A list of PHP classes called to fill or manipulate the items array. Each entry is keyed by a numeric index and requires a
classproperty. An optionalparametersobject can be passed to the processor.Example:
itemsProcessors: 0: class: 'Vendor\Extension\ItemsProcessor\MyProcessor' parameters: foo: barCopied!
itemsProcFunc
-
- Type
- string
Deprecated since version 2.3.0
Use
itemsinstead.Processors PHP method which is called to fill or manipulate the items array. See TCA itemsProcFunc.
itemsProcConfig
-
- Type
- object
Additional configuration passed to
items. Must be listed inProc Func allowed(included by default).Custom Properties
readOnly
-
- Type
- boolean
- Default
- false
Renders the field in a way that the user can see the value but cannot edit it.
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'