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 @@ -100,6 +100,25 @@ Inherited Options
100100
101101These options inherit from the :doc: `ChoiceType </reference/forms/types/choice >`:
102102
103+ choices
104+ ~~~~~~~
105+
106+ **type **: ``array `` **default **: ``[] ``
107+
108+ By default, this field displays all the cases of the related PHP enum. Use this
109+ option to explicitly define which options to display::
110+
111+ use App\Config\TextAlign;
112+ use Symfony\Component\Form\Extension\Core\Type\EnumType;
113+ // ...
114+
115+ $builder->add('alignment', EnumType::class, [
116+ 'choices' => [
117+ TextAlign::Left,
118+ TextAlign::Right,
119+ ],
120+ ]);
121+
103122.. include :: /reference/forms/types/options/choice_attr.rst.inc
104123
105124.. include :: /reference/forms/types/options/choice_filter.rst.inc
You can’t perform that action at this time.
0 commit comments