Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions reference/forms/types/enum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,25 @@ Inherited Options

These options inherit from the :doc:`ChoiceType </reference/forms/types/choice>`:

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
Expand Down