8000 deprecate not configuring widget option for DateType, DateTimeType, T… · symfony/symfony@f4348ea · GitHub
[go: up one dir, main page]

Skip to content

Commit f4348ea

Browse files
MrYamousnicolas-grekas
authored andcommitted
deprecate not configuring widget option for DateType, DateTimeType, TimeType
1 parent a1ffae9 commit f4348ea

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,12 @@ public function configureOptions(OptionsResolver $resolver)
248248
'view_timezone' => null,
249249
'format' => self::HTML5_FORMAT,
250250
'date_format' => null,
251-
'widget' => null,
251+
'widget' => function (Options $options) {
252+
trigger_deprecation('symfony/form', '6.3', 'Not configuring the "widget" option is deprecated. It will default to "single_text" in Symfony 7.0.');
253+
254+
return null;
255+
// return 'single_text';
256+
},
252257
'date_widget' => $dateWidget,
253258
'time_widget' => $timeWidget,
254259
'with_minutes' => true,

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,12 @@ public function configureOptions(OptionsResolver $resolver)
260260
'years' => range((int) date('Y') - 5, (int) date('Y') + 5),
261261
'months' => range(1, 12),
262262
'days' => range(1, 31),
263-
'widget' => 'choice',
263+
'widget' => function (Options $options) {
264+
trigger_deprecation('symfony/form', '6.3', 'Not configuring the "widget" option explicitly is deprecated, its default value will change to "single_text" in 7.0.');
265+
266+
return 'choice';
267+
// return 'single_text';
268+
},
264269
'input' => 'datetime',
265270
'format' => $format,
266271
'model_timezone' => null,

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,12 @@ public function configureOptions(OptionsResolver $resolver)
312312
'hours' => range(0, 23),
313313
'minutes' => range(0, 59),
314314
'seconds' => range(0, 59),
315-
'widget' => 'choice',
315+
'widget' => function (Options $options) {
316+
trigger_deprecation('symfony/form', '6.3', 'Not configuring the "widget" option explicitly is deprecated, its default value will change to "single_text" in 7.0.');
317+
318+
return 'choice';
319+
// return 'single_text';
320+
},
316321
'input' => 'datetime',
317322
'input_format' => 'H:i:s',
318323
'with_minutes' => true,

0 commit comments

Comments
 (0)
0