Skip to content

Commit d55d9b4

Browse files
committed
Removed more clutter in settings form translation
1 parent 8e11e06 commit d55d9b4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Form/InfoProviderSystem/ProviderSelectType.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
3131
use Symfony\Component\OptionsResolver\Options;
3232
use Symfony\Component\OptionsResolver\OptionsResolver;
33+
use Symfony\Component\Translation\StaticMessage;
3334

3435
class ProviderSelectType extends AbstractType
3536
{
@@ -70,7 +71,9 @@ public function configureOptions(OptionsResolver $resolver): void
7071
//The choice_label and choice_value only needs to be set if we want the objects
7172
$resolver->setDefault('choice_label', function (Options $options){
7273
if ('object' === $options['input']) {
73-
return ChoiceList::label($this, static fn (?InfoProviderInterface $choice) => $choice?->getProviderInfo()['name']);
74+
return ChoiceList::label($this, static fn (?InfoProviderInterface $choice) => new StaticMessage($choice?->getProviderInfo()['name']));
75+
} else {
76+
return static fn ($choice, $key, $value) => new StaticMessage($key);
7477
}
7578

7679
return null;

0 commit comments

Comments
 (0)