diff --git a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php index f0a2aaa0f1..4abd7ab5fc 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php @@ -395,6 +395,7 @@ class ChoiceType extends AbstractType $choiceOpts = [ 'value' => $choiceView->value, 'label' => $choiceView->label, + 'label_html' => $options['label_html'], 'attr' => $choiceView->attr, 'translation_domain' => $options['choice_translation_domain'], 'block_name' => 'entry', diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php index 9c8ae2b7e1..5cb9e8a5ba 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php @@ -392,6 +392,20 @@ class ChoiceTypeTest extends BaseTypeTest } } + public function testExpandedCheckboxesInhertLabelHtmlOption() + { + $form = $this->factory->create(static::TESTED_TYPE, null, [ + 'choices' => $this->choices, + 'expanded' => true, + 'label_html' => true, + 'multiple' => true, + ]); + + foreach ($form as $child) { + $this->assertTrue($child->getConfig()->getOption('label_html')); + } + } + public function testExpandedRadiosAreRequiredIfChoiceChildIsRequired() { $form = $this->factory->create(static::TESTED_TYPE, null, [ @@ -420,6 +434,20 @@ class ChoiceTypeTest extends BaseTypeTest } } + public function testExpandedRadiosInhertLabelHtmlOption() + { + $form = $this->factory->create(static::TESTED_TYPE, null, [ + 'choices' => $this->choices, + 'expanded' => true, + 'label_html' => true, + 'multiple' => false, + ]); + + foreach ($form as $child) { + $this->assertTrue($child->getConfig()->getOption('label_html')); + } + } + public function testSubmitSingleNonExpanded() { $form = $this->factory->create(static::TESTED_TYPE, null, [