Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Form] Changed "allow_html5" to "html5" #11994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 23, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2 src/Symfony/Component/Form/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions 10 src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -129,7 +129,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'empty_value',
'required',
'translation_domain',
'allow_html5',
'html5',
)));

if (null !== $options['date_widget']) {
Expand Down Expand Up @@ -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';
}
}
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions 6 src/Symfony/Component/Form/Extension/Core/Type/DateType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions 6 src/Symfony/Component/Form/Extension/Core/Type/TimeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.