Skip to content

Commit

Permalink
the default format option depends on the widget chosen (non regression)
Browse files Browse the repository at this point in the history
  • Loading branch information
pierreboissinot committed Mar 13, 2018
1 parent 1b520be commit 8cd7a42
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Form/Type/PhoneNumberType.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ public function configureOptions(OptionsResolver $resolver)
return PhoneNumberType::WIDGET_SINGLE_TEXT !== $options['widget'];
},
'default_region' => PhoneNumberUtil::UNKNOWN_REGION,
'format' => PhoneNumberFormat::INTERNATIONAL,
'format' => function (Options $options) {
return PhoneNumberType::WIDGET_SINGLE_TEXT === $options['widget']
? PhoneNumberFormat::INTERNATIONAL
: PhoneNumberFormat::NATIONAL;
},
'invalid_message' => 'This value is not a valid phone number.',
'by_reference' => false,
'error_bubbling' => false,
Expand Down

0 comments on commit 8cd7a42

Please sign in to comment.