8000 minor #11994 [Form] Changed "allow_html5" to "html5" (webmozart) · symfony/symfony@cc63edb · GitHub
[go: up one dir, main page]

Skip to content

Commit cc63edb

Browse files
committed
minor #11994 [Form] Changed "allow_html5" to "html5" (webmozart)
This PR was merged into the 2.6-dev branch. Discussion ---------- [Form] Changed "allow_html5" to "html5" | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - This is a follow-up to #8291, which I missed before it was merged. IMO "allow_html5" is a confusing name. We don't "allow" HTML5, but we use it - or we don't. I think "html5" conveys that meaning well and is shorter at the same time. Commits ------- ad171be [Form] Changed "allow_html5" to "html5"
2 parents 0050b8d + ad171be commit cc63edb

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

src/Symfony/Component/Form/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CHANGELOG
44
2.6.0
55
-----
66

7-
* added "allow_html5" option to Date, Time and DateTimeFormType to be able to
7+
* added "html5" option to Date, Time and DateTimeFormType to be able to
88
enable/disable HTML5 input date when widget option is "single_text"
99

1010
2.5.0

src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
117117
'empty_value',
118118
'required',
119119
'translation_domain',
120-
'allow_html5',
120+
'html5',
121121
)));
122122

123123
$timeOptions = array_intersect_key($options, array_flip(array(
@@ -129,7 +129,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
129129
'empty_value',
130130
'required',
131131
'translation_domain',
132-
'allow_html5',
132+
'html5',
133133
)));
134134

135135
if (null !== $options['date_widget']) {
@@ -185,8 +185,8 @@ public function buildView(FormView $view, FormInterface $form, array $options)
185185
// Change the input to a HTML5 datetime input if
186186
// * the widget is set to "single_text"
187187
// * the format matches the one expected by HTML5
188-
// * the allow_html5 is set to true
189-
if ($options['allow_html5'] && 'single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) {
188+
// * the html5 is set to true
189+
if ($options['html5'] && 'single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) {
190190
$view->vars['type'] = 'datetime';
191191
}
192192
}
@@ -221,7 +221,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
221221
'time_widget' => $timeWidget,
222222
'with_minutes' => true,
223223
'with_seconds' => false,
224-
'allow_html5' => true,
224+
'html5' => true,
225225
// Don't modify \DateTime classes by reference, we treat
226226
// them like immutable value objects
227227
'by_reference' => false,

src/Symfony/Component/Form/Extension/Core/Type/DateType.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ public function finishView(FormView $view, FormInterface $form, array $options)
136136
// Change the input to a HTML5 date input if
137137
// * the widget is set to "single_text"
138138
// * the format matches the one expected by HTML5
139-
// * the allow_html5 is set to true
140-
if ($options['allow_html5'] && 'single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) {
139+
// * the html5 is set to true
140+
if ($options['html5'] && 'single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) {
141141
$view->vars['type'] = 'date';
142142
}
143143

@@ -206,7 +206,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
206206
'model_timezone' => null,
207207
'view_timezone' => null,
208208
'empty_value' => $emptyValue,
209-
'allow_html5' => true,
209+
'html5' => true,
210210
// Don't modify \DateTime classes by reference, we treat
211211
// them like immutable value objects
212212
'by_reference' => false,

src/Symfony/Component/Form/Extension/Core/Type/TimeType.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ public function buildView(FormView $view, FormInterface $form, array $options)
140140

141141
// Change the input to a HTML5 time input if
142142
// * the widget is set to "single_text"
143-
// * the allow_html5 is set to true
144-
if ($options['allow_html5'] && 'single_text' === $options['widget']) {
143+
// * the html5 is set to true
144+
if ($options['html5'] && 'single_text' === $options['widget']) {
145145
$view->vars['type'] = 'time';
146146

147147
// we need to force the browser to display the seconds by
@@ -195,7 +195,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
195195
'model_timezone' => null,
196196
'view_timezone' => null,
197197
'empty_value' => $emptyValue,
198-
'allow_html5' => true,
198+
'html5' => true,
199199
// Don't modify \DateTime classes by reference, we treat
200200
// them like immutable value objects
201201
'by_reference' => false,

src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ public function testDontPassHtml5TypeIfHtml5NotAllowed()
409409
{
410410
$form = $this->factory->create('datetime', null, array(
411411
'widget' => 'single_text',
412-
'allow_html5' => false,
412+
'html5' => false,
413413
));
414414

415415
$view = $form->createView();

src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ public function testDontPassHtml5TypeIfHtml5NotAllowed()
709709
{
710710
$form = $this->factory->create('date', null, array(
711711
'widget' => 'single_text',
712-
'allow_html5' => false,
712+
'html5' => false,
713713
));
714714

715715
$view = $form->createView();

src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ public function testDontPassHtml5TypeIfHtml5NotAllowed()
523523
{
524524
$form = $this->factory->create('time', null, array(
525525
'widget' => 'single_text',
526-
'allow_html5' => false,
526+
'html5' => false,
527527
));
528528

529529
$view = $form->createView();

0 commit comments

Comments
 (0)
0