From ba5d7f99e99c4bdf56adbe512212fb91eaa22f34 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 27 Jan 2016 13:22:05 +0100 Subject: [PATCH] Improved Bootstrap form theme for hidden fields --- .../views/Form/bootstrap_3_layout.html.twig | 2 +- src/Symfony/Bridge/Twig/composer.json | 2 +- .../Tests/AbstractBootstrap3LayoutTest.php | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig index 5affc7a6a1..8676e18987 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig @@ -3,7 +3,7 @@ {# Widgets #} {% block form_widget_simple -%} - {% if type is not defined or 'file' != type %} + {% if type is not defined or type not in ['file', 'hidden'] %} {%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) -%} {% endif %} {{- parent() -}} diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json index 2e569d7435..02dd9140ff 100644 --- a/src/Symfony/Bridge/Twig/composer.json +++ b/src/Symfony/Bridge/Twig/composer.json @@ -22,7 +22,7 @@ "require-dev": { "symfony/asset": "~2.7", "symfony/finder": "~2.3", - "symfony/form": "~2.7,>=2.7.8", + "symfony/form": "~2.7.10|~2.8.3", "symfony/http-kernel": "~2.3", "symfony/intl": "~2.3", "symfony/routing": "~2.2", diff --git a/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php index 3bafd0ea24..51cc66aceb 100644 --- a/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php @@ -664,7 +664,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest ./input[@type="radio"][@name="name"][@id="name_1"][@value="&b"][not(@checked)] ] ] - /following-sibling::input[@type="hidden"][@id="name__token"][@class="form-control"] + /following-sibling::input[@type="hidden"][@id="name__token"] ] ' ); @@ -701,7 +701,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest ./input[@type="radio"][@name="name"][@id="name_1"][@value="&b"][not(@checked)] ] ] - /following-sibling::input[@type="hidden"][@id="name__token"][@class="form-control"] + /following-sibling::input[@type="hidden"][@id="name__token"] ] ' ); @@ -740,7 +740,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest ./input[@type="radio"][@name="name"][@id="name_1"][@value="&b"][not(@checked)]'.$classPart.' ] ] - /following-sibling::input[@type="hidden"][@id="name__token"][@class="form-control"] + /following-sibling::input[@type="hidden"][@id="name__token"] ] ' ); @@ -786,7 +786,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest ./input[@type="radio"][@name="name"][@id="name_1"][not(@checked)] ] ] - /following-sibling::input[@type="hidden"][@id="name__token"][@class="form-control"] + /following-sibling::input[@type="hidden"][@id="name__token"] ] ' ); @@ -822,7 +822,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest ./input[@type="radio"][@name="name"][@id="name_1"][not(@checked)] ] ] - /following-sibling::input[@type="hidden"][@id="name__token"][@class="form-control"] + /following-sibling::input[@type="hidden"][@id="name__token"] ] ' ); @@ -868,7 +868,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest ./input[@type="checkbox"][@name="name[]"][@id="name_2"][@checked][not(@required)] ] ] - /following-sibling::input[@type="hidden"][@id="name__token"][@class="form-control"] + /following-sibling::input[@type="hidden"][@id="name__token"] ] ' ); @@ -915,7 +915,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest ./input[@type="checkbox"][@name="name[]"][@id="name_2"][@checked][not(@required)] ] ] - /following-sibling::input[@type="hidden"][@id="name__token"][@class="form-control"] + /following-sibling::input[@type="hidden"][@id="name__token"] ] ' ); @@ -964,7 +964,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest ./input[@type="checkbox"][@name="name[]"][@id="name_2"][@checked][not(@required)] ] ] - /following-sibling::input[@type="hidden"][@id="name__token"][@class="form-control"] + /following-sibling::input[@type="hidden"][@id="name__token"] ] ' ); @@ -1466,7 +1466,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest '/input [@type="hidden"] [@name="name"] - [@class="my&class form-control"] + [@class="my&class"] [@value="foo&bar"] ' );