From 47e46bdf57556f389b7a2d632affdb4637fdd959 Mon Sep 17 00:00:00 2001 From: Dorian Savina Date: Tue, 30 Jul 2019 18:08:56 +0200 Subject: [PATCH] [view] expose sub-fields option "attr" (WIDGET_COUNTRY_CHOICE) Signed-off-by: Dorian Savina --- Form/Type/PhoneNumberType.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Form/Type/PhoneNumberType.php b/Form/Type/PhoneNumberType.php index d7990979..5fe03b07 100644 --- a/Form/Type/PhoneNumberType.php +++ b/Form/Type/PhoneNumberType.php @@ -101,7 +101,16 @@ public function buildForm(FormBuilderInterface $builder, array $options) $countryOptions['placeholder'] = $options['country_placeholder']; } + if ($options['country_attr']) { + $countryOptions['attr'] = $options['country_attr']; + } + + if ($options['number_attr']) { + $numberOptions['attr'] = $options['number_attr']; + } + $builder + ->add('country', $choiceType, $countryOptions) ->add('number', $textType, $numberOptions) ->addViewTransformer(new PhoneNumberToArrayTransformer($transformerChoices)); @@ -150,6 +159,8 @@ public function configureOptions(OptionsResolver $resolver) 'error_bubbling' => false, 'country_choices' => array(), 'country_placeholder' => false, + 'country_attr' => array(), + 'number_attr' => array(), 'preferred_country_choices' => array(), ) );