diff --git a/src/Symfony/Component/Form/CHANGELOG.md b/src/Symfony/Component/Form/CHANGELOG.md index c663c960fb7c..4381726126d4 100644 --- a/src/Symfony/Component/Form/CHANGELOG.md +++ b/src/Symfony/Component/Form/CHANGELOG.md @@ -4,7 +4,7 @@ CHANGELOG 2.6.0 ----- - * added "allow_html5" option to Date, Time and DateTimeFormType to be able to + * added "html5" option to Date, Time and DateTimeFormType to be able to enable/disable HTML5 input date when widget option is "single_text" 2.5.0 diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php index 88dd9d94d107..cad1c5e8d5d6 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php @@ -117,7 +117,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'empty_value', 'required', 'translation_domain', - 'allow_html5', + 'html5', ))); $timeOptions = array_intersect_key($options, array_flip(array( @@ -129,7 +129,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'empty_value', 'required', 'translation_domain', - 'allow_html5', + 'html5', ))); if (null !== $options['date_widget']) { @@ -185,8 +185,8 @@ public function buildView(FormView $view, FormInterface $form, array $options) // Change the input to a HTML5 datetime input if // * the widget is set to "single_text" // * the format matches the one expected by HTML5 - // * the allow_html5 is set to true - if ($options['allow_html5'] && 'single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) { + // * the html5 is set to true + if ($options['html5'] && 'single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) { $view->vars['type'] = 'datetime'; } } @@ -221,7 +221,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) 'time_widget' => $timeWidget, 'with_minutes' => true, 'with_seconds' => false, - 'allow_html5' => true, + 'html5' => true, // Don't modify \DateTime classes by reference, we treat // them like immutable value objects 'by_reference' => false, diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php index 757a9904c31c..35657742e588 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php @@ -136,8 +136,8 @@ public function finishView(FormView $view, FormInterface $form, array $options) // Change the input to a HTML5 date input if // * the widget is set to "single_text" // * the format matches the one expected by HTML5 - // * the allow_html5 is set to true - if ($options['allow_html5'] && 'single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) { + // * the html5 is set to true + if ($options['html5'] && 'single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) { $view->vars['type'] = 'date'; } @@ -206,7 +206,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) 'model_timezone' => null, 'view_timezone' => null, 'empty_value' => $emptyValue, - 'allow_html5' => true, + 'html5' => true, // Don't modify \DateTime classes by reference, we treat // them like immutable value objects 'by_reference' => false, diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php index eebfc35ceee3..223c3d92893d 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php @@ -140,8 +140,8 @@ public function buildView(FormView $view, FormInterface $form, array $options) // Change the input to a HTML5 time input if // * the widget is set to "single_text" - // * the allow_html5 is set to true - if ($options['allow_html5'] && 'single_text' === $options['widget']) { + // * the html5 is set to true + if ($options['html5'] && 'single_text' === $options['widget']) { $view->vars['type'] = 'time'; // we need to force the browser to display the seconds by @@ -195,7 +195,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) 'model_timezone' => null, 'view_timezone' => null, 'empty_value' => $emptyValue, - 'allow_html5' => true, + 'html5' => true, // Don't modify \DateTime classes by reference, we treat // them like immutable value objects 'by_reference' => false, diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php index 35b6ab45a891..e45f6134e829 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php @@ -409,7 +409,7 @@ public function testDontPassHtml5TypeIfHtml5NotAllowed() { $form = $this->factory->create('datetime', null, array( 'widget' => 'single_text', - 'allow_html5' => false, + 'html5' => false, )); $view = $form->createView(); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php index 8e128584217d..28e681a28cdf 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php @@ -709,7 +709,7 @@ public function testDontPassHtml5TypeIfHtml5NotAllowed() { $form = $this->factory->create('date', null, array( 'widget' => 'single_text', - 'allow_html5' => false, + 'html5' => false, )); $view = $form->createView(); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php index e1129e0e156e..d74dc69ace2c 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php @@ -523,7 +523,7 @@ public function testDontPassHtml5TypeIfHtml5NotAllowed() { $form = $this->factory->create('time', null, array( 'widget' => 'single_text', - 'allow_html5' => false, + 'html5' => false, )); $view = $form->createView();