bug #18275 [Form] Fix BC break introduced in #14403 (HeahDude)

This PR was merged into the 2.8 branch.

Discussion
----------

[Form] Fix BC break introduced in #14403

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | -

Commits
-------

5f48c6a [Form] Fix BC break introduced in #14403
This commit is contained in:
Fabien Potencier 2016-03-27 12:21:58 +02:00
commit 56fa7989a8
5 changed files with 8 additions and 5 deletions

View File

@ -319,9 +319,10 @@
{%- block widget_attributes -%}
id="{{ id }}" name="{{ full_name }}"
{%- if read_only %} readonly="readonly"{% endif -%}
{%- if disabled %} disabled="disabled"{% endif -%}
{%- if required %} required="required"{% endif -%}
{%- for attrname, attrvalue in attr -%}
{%- for attrname, attrvalue in attr if 'readonly' != attrname -%}
{{- " " -}}
{%- if attrname in ['placeholder', 'title'] -%}
{{- attrname }}="{{ translation_domain is same as(false) ? attrvalue : attrvalue|trans({}, translation_domain) }}"

View File

@ -1,6 +1,8 @@
id="<?php echo $view->escape($id) ?>" name="<?php echo $view->escape($full_name) ?>"<?php if ($disabled): ?> disabled="disabled"<?php endif ?>
id="<?php echo $view->escape($id) ?>" name="<?php echo $view->escape($full_name) ?>"<?php if ($read_only): ?> readonly="readonly"<?php endif ?>
<?php if ($disabled): ?> disabled="disabled"<?php endif ?>
<?php if ($required): ?> required="required"<?php endif ?>
<?php foreach ($attr as $k => $v): ?>
<?php if ('readonly' === $k) { continue; } ?>
<?php if (in_array($k, array('placeholder', 'title'), true)): ?>
<?php printf(' %s="%s"', $view->escape($k), $view->escape(false !== $translation_domain ? $view['translator']->trans($v, array(), $translation_domain) : $v)) ?>
<?php elseif ($v === true): ?>

View File

@ -43,7 +43,7 @@
"symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0",
"symfony/polyfill-intl-icu": "~1.0",
"symfony/security": "~2.6|~3.0.0",
"symfony/form": "~2.8",
"symfony/form": "^2.8.4",
"symfony/expression-language": "~2.6|~3.0.0",
"symfony/process": "~2.0,>=2.0.5|~3.0.0",
"symfony/validator": "~2.5|~3.0.0",

View File

@ -2430,7 +2430,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
$html = $this->renderWidget($form->createView());
// compare plain HTML to check the whitespace
$this->assertSame('<input type="text" id="text" name="text" disabled="disabled" required="required" readonly="readonly" maxlength="10" pattern="\d+" class="foobar form-control" data-foo="bar" value="value" />', $html);
$this->assertSame('<input type="text" id="text" name="text" readonly="readonly" disabled="disabled" required="required" maxlength="10" pattern="\d+" class="foobar form-control" data-foo="bar" value="value" />', $html);
}
public function testWidgetAttributeNameRepeatedIfTrue()

View File

@ -2373,7 +2373,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
$html = $this->renderWidget($form->createView());
// compare plain HTML to check the whitespace
$this->assertSame('<input type="text" id="text" name="text" disabled="disabled" required="required" readonly="readonly" maxlength="10" pattern="\d+" class="foobar" data-foo="bar" value="value" />', $html);
$this->assertSame('<input type="text" id="text" name="text" readonly="readonly" disabled="disabled" required="required" maxlength="10" pattern="\d+" class="foobar" data-foo="bar" value="value" />', $html);
}
public function testWidgetAttributeNameRepeatedIfTrue()