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
9494
9595These options inherit from the :doc: `ChoiceType </reference/forms/types/choice >`:
9696
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+
97116.. include :: /reference/forms/types/options/choice_attr.rst.inc
98117
99118.. include :: /reference/forms/types/options/choice_filter.rst.inc
You can’t perform that action at this time.
0 commit comments