[Form] Fix BC break introduced in #14403
This commit is contained in:
parent
a8843132b8
commit
5f48c6ac9a
@ -319,9 +319,10 @@
|
|||||||
|
|
||||||
{%- block widget_attributes -%}
|
{%- block widget_attributes -%}
|
||||||
id="{{ id }}" name="{{ full_name }}"
|
id="{{ id }}" name="{{ full_name }}"
|
||||||
|
{%- if read_only %} readonly="readonly"{% endif -%}
|
||||||
{%- if disabled %} disabled="disabled"{% endif -%}
|
{%- if disabled %} disabled="disabled"{% endif -%}
|
||||||
{%- if required %} required="required"{% endif -%}
|
{%- if required %} required="required"{% endif -%}
|
||||||
{%- for attrname, attrvalue in attr -%}
|
{%- for attrname, attrvalue in attr if 'readonly' != attrname -%}
|
||||||
{{- " " -}}
|
{{- " " -}}
|
||||||
{%- if attrname in ['placeholder', 'title'] -%}
|
{%- if attrname in ['placeholder', 'title'] -%}
|
||||||
{{- attrname }}="{{ translation_domain is same as(false) ? attrvalue : attrvalue|trans({}, translation_domain) }}"
|
{{- attrname }}="{{ translation_domain is same as(false) ? attrvalue : attrvalue|trans({}, translation_domain) }}"
|
||||||
|
@ -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 if ($required): ?> required="required"<?php endif ?>
|
||||||
<?php foreach ($attr as $k => $v): ?>
|
<?php foreach ($attr as $k => $v): ?>
|
||||||
|
<?php if ('readonly' === $k) { continue; } ?>
|
||||||
<?php if (in_array($k, array('placeholder', 'title'), true)): ?>
|
<?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 printf(' %s="%s"', $view->escape($k), $view->escape(false !== $translation_domain ? $view['translator']->trans($v, array(), $translation_domain) : $v)) ?>
|
||||||
<?php elseif ($v === true): ?>
|
<?php elseif ($v === true): ?>
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
"symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0",
|
"symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0",
|
||||||
"symfony/polyfill-intl-icu": "~1.0",
|
"symfony/polyfill-intl-icu": "~1.0",
|
||||||
"symfony/security": "~2.6|~3.0.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/expression-language": "~2.6|~3.0.0",
|
||||||
"symfony/process": "~2.0,>=2.0.5|~3.0.0",
|
"symfony/process": "~2.0,>=2.0.5|~3.0.0",
|
||||||
"symfony/validator": "~2.5|~3.0.0",
|
"symfony/validator": "~2.5|~3.0.0",
|
||||||
|
@ -2430,7 +2430,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
|
|||||||
$html = $this->renderWidget($form->createView());
|
$html = $this->renderWidget($form->createView());
|
||||||
|
|
||||||
// compare plain HTML to check the whitespace
|
// 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()
|
public function testWidgetAttributeNameRepeatedIfTrue()
|
||||||
|
@ -2373,7 +2373,7 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
|
|||||||
$html = $this->renderWidget($form->createView());
|
$html = $this->renderWidget($form->createView());
|
||||||
|
|
||||||
// compare plain HTML to check the whitespace
|
// 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()
|
public function testWidgetAttributeNameRepeatedIfTrue()
|
||||||
|
Reference in New Issue
Block a user