File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,25 @@ Inherited Options
94
94
95
95
These options inherit from the :doc: `ChoiceType </reference/forms/types/choice >`:
96
96
97
+ choices
98
+ ~~~~~~~
99
+
100
+ **type **: ``array `` **default **: ``[] ``
101
+
102
+ By default, this field displays all the cases of the related PHP enum. Use this
103
+ option to explicitly define which options to display::
104
+
105
+ use App\Config\TextAlign;
106
+ use Symfony\Component\Form\Extension\Core\Type\EnumType;
107
+ // ...
108
+
109
+ $builder->add('alignment', EnumType::class, [
110
+ 'choices' => [
111
+ TextAlign::Left,
112
+ TextAlign::Right,
113
+ ],
114
+ ]);
115
+
97
116
.. include :: /reference/forms/types/options/choice_attr.rst.inc
98
117
99
118
.. include :: /reference/forms/types/options/choice_filter.rst.inc
You can’t perform that action at this time.
0 commit comments