From 3a365382c7d01eaeba25d439d6fe005c6fd12ab4 Mon Sep 17 00:00:00 2001 From: Christian Beeznest Date: Mon, 13 Oct 2025 20:32:32 -0500 Subject: [PATCH] User: Fix tags editable from edit profile form - refs BT#23006 --- src/CoreBundle/Form/ExtraFieldType.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/CoreBundle/Form/ExtraFieldType.php b/src/CoreBundle/Form/ExtraFieldType.php index 6aba1fde6c6..3e8c2a91ff4 100644 --- a/src/CoreBundle/Form/ExtraFieldType.php +++ b/src/CoreBundle/Form/ExtraFieldType.php @@ -158,8 +158,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void $defaultOptions['expanded'] = false; $defaultOptions['multiple'] = true; - // Preload existing user tags as choices (if any) - $class = 'select2_extra_rel_tag'; + $class = 'select2_user_rel_tag'; $choices = []; $choicesAttributes = []; if ($item instanceof User) { @@ -175,13 +174,13 @@ public function buildForm(FormBuilderInterface $builder, array $options): void } $defaultOptions['choices'] = $choices; $defaultOptions['choice_attr'] = $choicesAttributes; - $defaultOptions['data'] = $choices; - - $defaultOptions['attr'] = [ + $defaultOptions['data'] = array_values($choices); + $defaultOptions['attr'] = array_merge($defaultOptions['attr'] ?? [], [ 'class' => $class, 'style' => 'width:500px', - 'data.field_id' => $extraField->getId(), - ]; + 'data.field_id' => (string) $extraField->getId(), + ]); + $builder->add($variable, ChoiceType::class, $defaultOptions); break;