diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/custom_widgets.html.twig b/src/Symfony/Bridge/Twig/Tests/Extension/custom_widgets.html.twig
index 12fd7c66d8..4eda8d76d3 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/custom_widgets.html.twig
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/custom_widgets.html.twig
@@ -6,11 +6,20 @@
{% endspaceless %}
{% endblock _text_id_widget %}
-{% block _name_entry_label %}
+{% block _names_entry_label %}
{% spaceless %}
{% if label is empty %}
{% set label = name|humanize %}
{% endif %}
{% endspaceless %}
-{% endblock _name_entry_label %}
+{% endblock _names_entry_label %}
+
+{% block _name_c_entry_label %}
+{% spaceless %}
+ {% if label is empty %}
+ {% set label = name|humanize %}
+ {% endif %}
+
+{% endspaceless %}
+{% endblock _name_c_entry_label %}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php
new file mode 100644
index 0000000000..05240035c0
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php
@@ -0,0 +1,2 @@
+humanize($name); } ?>
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_names_entry_label.html.php
similarity index 100%
rename from src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php
rename to src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_names_entry_label.html.php
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
index d3d9187c0c..eb7ae3b1e2 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
@@ -256,6 +256,7 @@ class ChoiceType extends AbstractType
'value' => $choiceView->value,
'label' => $choiceView->label,
'translation_domain' => $options['translation_domain'],
+ 'block_name' => 'entry',
);
if ($options['multiple']) {
diff --git a/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php
index ee9ed8f2a6..c4a825bd2d 100644
--- a/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php
@@ -283,7 +283,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testCollection()
{
- $form = $this->factory->createNamed('name', 'collection', array('a', 'b'), array(
+ $form = $this->factory->createNamed('names', 'collection', array('a', 'b'), array(
'type' => 'text',
));
@@ -305,7 +305,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
array('title' => 'a'),
array('title' => 'b'),
);
- $form = $this->factory->createNamed('name', 'collection', $data, array(
+ $form = $this->factory->createNamed('names', 'collection', $data, array(
'type' => new AlternatingRowType(),
));
@@ -323,13 +323,13 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testEmptyCollection()
{
- $form = $this->factory->createNamed('name', 'collection', array(), array(
+ $form = $this->factory->createNamed('names', 'collection', array(), array(
'type' => 'text',
));
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/div
- [./input[@type="hidden"][@id="name__token"]]
+ [./input[@type="hidden"][@id="names__token"]]
[count(./div)=0]
'
);
@@ -670,7 +670,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
public function testCollectionRowWithCustomBlock()
{
$collection = array('one', 'two', 'three');
- $form = $this->factory->createNamedBuilder('name', 'collection', $collection)
+ $form = $this->factory->createNamedBuilder('names', 'collection', $collection)
->getForm();
$this->assertWidgetMatchesXpath($form->createView(), array(),
@@ -684,6 +684,28 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
);
}
+ /**
+ * The block "_name_c_entry_label" should be overridden in the theme of the
+ * implemented driver.
+ */
+ public function testChoiceRowWithCustomBlock()
+ {
+ $form = $this->factory->createNamedBuilder('name_c', 'choice', 'a', array(
+ 'choices' => array('a' => 'ChoiceA', 'b' => 'ChoiceB'),
+ 'expanded' => true,
+ ))
+ ->getForm();
+
+ $this->assertWidgetMatchesXpath($form->createView(), array(),
+'/div
+ [
+ ./label[.="Custom name label: [trans]ChoiceA[/trans]"]
+ /following-sibling::label[.="Custom name label: [trans]ChoiceB[/trans]"]
+ ]
+'
+ );
+ }
+
public function testFormEndWithRest()
{
$view = $this->factory->createNamedBuilder('name', 'form')
diff --git a/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php
index 5c91195169..7e7c8f33eb 100644
--- a/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php
@@ -193,7 +193,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testCollection()
{
- $form = $this->factory->createNamed('name', 'collection', array('a', 'b'), array(
+ $form = $this->factory->createNamed('names', 'collection', array('a', 'b'), array(
'type' => 'text',
));
@@ -202,7 +202,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
[
./tr[./td/input[@type="text"][@value="a"]]
/following-sibling::tr[./td/input[@type="text"][@value="b"]]
- /following-sibling::tr[@style="display: none"][./td[@colspan="2"]/input[@type="hidden"][@id="name__token"]]
+ /following-sibling::tr[@style="display: none"][./td[@colspan="2"]/input[@type="hidden"][@id="names__token"]]
]
[count(./tr[./td/input])=3]
'
@@ -211,13 +211,13 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testEmptyCollection()
{
- $form = $this->factory->createNamed('name', 'collection', array(), array(
+ $form = $this->factory->createNamed('names', 'collection', array(), array(
'type' => 'text',
));
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/table
- [./tr[@style="display: none"][./td[@colspan="2"]/input[@type="hidden"][@id="name__token"]]]
+ [./tr[@style="display: none"][./td[@colspan="2"]/input[@type="hidden"][@id="names__token"]]]
[count(./tr[./td/input])=1]
'
);
@@ -439,7 +439,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
public function testCollectionRowWithCustomBlock()
{
$collection = array('one', 'two', 'three');
- $form = $this->factory->createNamedBuilder('name', 'collection', $collection)
+ $form = $this->factory->createNamedBuilder('names', 'collection', $collection)
->getForm();
$this->assertWidgetMatchesXpath($form->createView(), array(),