mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-06 02:59:29 +00:00
Removed more clutter in settings form translation
This commit is contained in:
parent
8e11e06077
commit
d55d9b43f9
1 changed files with 4 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ use Symfony\Component\Form\ChoiceList\ChoiceList;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\OptionsResolver\Options;
|
use Symfony\Component\OptionsResolver\Options;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
use Symfony\Component\Translation\StaticMessage;
|
||||||
|
|
||||||
class ProviderSelectType extends AbstractType
|
class ProviderSelectType extends AbstractType
|
||||||
{
|
{
|
||||||
|
|
@ -70,7 +71,9 @@ class ProviderSelectType extends AbstractType
|
||||||
//The choice_label and choice_value only needs to be set if we want the objects
|
//The choice_label and choice_value only needs to be set if we want the objects
|
||||||
$resolver->setDefault('choice_label', function (Options $options){
|
$resolver->setDefault('choice_label', function (Options $options){
|
||||||
if ('object' === $options['input']) {
|
if ('object' === $options['input']) {
|
||||||
return ChoiceList::label($this, static fn (?InfoProviderInterface $choice) => $choice?->getProviderInfo()['name']);
|
return ChoiceList::label($this, static fn (?InfoProviderInterface $choice) => new StaticMessage($choice?->getProviderInfo()['name']));
|
||||||
|
} else {
|
||||||
|
return static fn ($choice, $key, $value) => new StaticMessage($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue