bug #15345 [Twig+FrameworkBundle] Fix forward compat with Form 2.8 (nicolas-grekas)

This PR was merged into the 2.7 branch.

Discussion
----------

[Twig+FrameworkBundle] Fix forward compat with Form 2.8

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

When these layouts are used with form 2.8, the readonly attribute is rendered twice. This has no practical consequence, but it breaks tests. This is the last fix required to make 2.7 green again.

Commits
-------

75dc464 [Twig+FrameworkBundle] Fix forward compat with Form 2.8
This commit is contained in:
Fabien Potencier 2015-07-24 09:08:55 +02:00
commit 4b136f9e35
7 changed files with 52 additions and 2 deletions

View File

@ -314,7 +314,7 @@
{%- block widget_attributes -%}
id="{{ id }}" name="{{ full_name }}"
{%- if read_only %} readonly="readonly"{% endif -%}
{%- if read_only and attr.readonly is not defined %} readonly="readonly"{% endif -%}
{%- if disabled %} disabled="disabled"{% endif -%}
{%- if required %} required="required"{% endif -%}
{%- for attrname, attrvalue in attr -%}

View File

@ -115,4 +115,14 @@ class FormExtensionBootstrap3LayoutTest extends AbstractBootstrap3LayoutTest
{
$this->extension->renderer->setTheme($view, $themes);
}
public function testRange()
{
// No-op for forward compatibility with AbstractLayoutTest 2.8
}
public function testRangeWithMinMaxValues()
{
// No-op for forward compatibility with AbstractLayoutTest 2.8
}
}

View File

@ -208,4 +208,14 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest
array(array('parent_label.html.twig'), array('child_label.html.twig')),
);
}
public function testRange()
{
// No-op for forward compatibility with AbstractLayoutTest 2.8
}
public function testRangeWithMinMaxValues()
{
// No-op for forward compatibility with AbstractLayoutTest 2.8
}
}

View File

@ -116,4 +116,14 @@ class FormExtensionTableLayoutTest extends AbstractTableLayoutTest
{
$this->extension->renderer->setTheme($view, $themes);
}
public function testRange()
{
// No-op for forward compatibility with AbstractLayoutTest 2.8
}
public function testRangeWithMinMaxValues()
{
// No-op for forward compatibility with AbstractLayoutTest 2.8
}
}

View File

@ -1,4 +1,4 @@
id="<?php echo $view->escape($id) ?>" name="<?php echo $view->escape($full_name) ?>" <?php if ($read_only): ?>readonly="readonly" <?php endif ?>
id="<?php echo $view->escape($id) ?>" name="<?php echo $view->escape($full_name) ?>" <?php if ($read_only && !isset($attr['readonly'])): ?>readonly="readonly" <?php endif ?>
<?php if ($disabled): ?>disabled="disabled" <?php endif ?>
<?php if ($required): ?>required="required" <?php endif ?>
<?php foreach ($attr as $k => $v): ?>

View File

@ -128,4 +128,14 @@ class FormHelperDivLayoutTest extends AbstractDivLayoutTest
array(array('TestBundle:Parent'), array('TestBundle:Child')),
);
}
public function testRange()
{
// No-op for forward compatibility with AbstractLayoutTest 2.8
}
public function testRangeWithMinMaxValues()
{
// No-op for forward compatibility with AbstractLayoutTest 2.8
}
}

View File

@ -115,4 +115,14 @@ class FormHelperTableLayoutTest extends AbstractTableLayoutTest
{
$this->engine->get('form')->setTheme($view, $themes);
}
public function testRange()
{
// No-op for forward compatibility with AbstractLayoutTest 2.8
}
public function testRangeWithMinMaxValues()
{
// No-op for forward compatibility with AbstractLayoutTest 2.8
}
}