Skip to content

Commit 2effda7

Browse files
VincentLangletnicolas-grekas
authored andcommitted
[Form] Fix ChoiceType translation domain
1 parent 13982b5 commit 2effda7

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ private function addSubForm(FormBuilderInterface $builder, $name, ChoiceView $ch
386386
'value' => $choiceView->value,
387387
'label' => $choiceView->label,
388388
'attr' => $choiceView->attr,
389-
'translation_domain' => $options['translation_domain'],
389+
'translation_domain' => $options['choice_translation_domain'],
390390
'block_name' => 'entry',
391391
];
392392

src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1994,6 +1994,24 @@ public function testStripLeadingUnderscoresAndDigitsFromId()
19941994
$this->assertEquals('_09name', $view->vars['full_name']);
19951995
}
19961996

1997+
public function testSubFormTranslationDomain()
1998+
{
1999+
$form = $this->factory->create(static::TESTED_TYPE, null, [
2000+
'label' => 'label',
2001+
'translation_domain' => 'label_translation_domain',
2002+
'choices' => [
2003+
'choice1' => true,
2004+
'choice2' => false,
2005+
],
2006+
'choice_translation_domain' => 'choice_translation_domain',
2007+
'expanded' => true,
2008+
])->createView();
2009+
2010+
$this->assertCount(2, $form->children);
2011+
$this->assertSame('choice_translation_domain', $form->children[0]->vars['translation_domain']);
2012+
$this->assertSame('choice_translation_domain', $form->children[1]->vars['translation_domain']);
2013+
}
2014+
19972015
/**
19982016
* @dataProvider provideTrimCases
19992017
*/

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy