Use the choice
type for fields whose value must be a member of a list.
Included in the PerformBaseBundle.
An array of choices, where the keys are the labels, and values the possible value.
This option is required.
Allowed types: array
Defaults:
The label to use for form labels and table headings. If no label is provided, a sensible label will be created automatically.
This option is optional.
Allowed types: string
Defaults:
If true, display the choice label instead of the value in list
and view
contexts.
This option is optional.
Allowed types: boolean
Defaults:
true
true
true
true
The value to show when show_label is true and the value is not in the list of choices.
This option is optional.
Allowed types: string
Defaults:
''
''
''
''
<?php
$config->add('status', [
'type' => 'choice',
'options' => [
'choices' => [
'Started' => 1,
'In Progress' => 2,
'Done' => 3,
],
],
'sort' => false,
]);