From 6006484720eb479a2aa7231a4e06d664c286b603 Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Thu, 2 Oct 2025 16:15:10 +0200 Subject: [PATCH] [Form] `EnumType` Mentioning array keys of `choices` Page: https://symfony.com/doc/6.4/reference/forms/types/enum.html#choices Feature is added in https://github.com/symfony/symfony/pull/61928 - so you probably want to merge this only when that PR has been released. --- reference/forms/types/enum.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/reference/forms/types/enum.rst b/reference/forms/types/enum.rst index c7839d6e7ed..64efd54aa39 100644 --- a/reference/forms/types/enum.rst +++ b/reference/forms/types/enum.rst @@ -119,6 +119,13 @@ option to explicitly define which options to display:: ], ]); +You can add keys to the `choices` array, which will then be used as labels:: + + 'choices' => [ + 'Align to the right' => TextAlign::Left, + 'Align to the left' => TextAlign::Right, + ], + .. include:: /reference/forms/types/options/choice_attr.rst.inc .. include:: /reference/forms/types/options/choice_filter.rst.inc