diff --git a/reference/forms/types/enum.rst b/reference/forms/types/enum.rst index 6a78004c7ff..c7839d6e7ed 100644 --- a/reference/forms/types/enum.rst +++ b/reference/forms/types/enum.rst @@ -100,6 +100,25 @@ Inherited Options These options inherit from the :doc:`ChoiceType `: +choices +~~~~~~~ + +**type**: ``array`` **default**: ``[]`` + +By default, this field displays all the cases of the related PHP enum. Use this +option to explicitly define which options to display:: + + use App\Config\TextAlign; + use Symfony\Component\Form\Extension\Core\Type\EnumType; + // ... + + $builder->add('alignment', EnumType::class, [ + 'choices' => [ + TextAlign::Left, + TextAlign::Right, + ], + ]); + .. include:: /reference/forms/types/options/choice_attr.rst.inc .. include:: /reference/forms/types/options/choice_filter.rst.inc