mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 23:53:50 +00:00
Fix translations of form fields in admin for social actions
This commit is contained in:
@@ -25,21 +25,14 @@ use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
* Class SocialActionType.
|
||||
*/
|
||||
class SocialActionType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* @var TranslatableStringHelper
|
||||
*/
|
||||
protected $translatableStringHelper;
|
||||
|
||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly TranslatorInterface $translator) {}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
@@ -64,6 +57,7 @@ class SocialActionType extends AbstractType
|
||||
->add('results', EntityType::class, [
|
||||
'class' => Result::class,
|
||||
'required' => false,
|
||||
'label' => $this->translator->trans('person_admin.social_result'),
|
||||
'multiple' => true,
|
||||
'attr' => ['class' => 'select2'],
|
||||
'choice_label' => fn (Result $r) => $this->translatableStringHelper->localize($r->getTitle()),
|
||||
@@ -74,6 +68,7 @@ class SocialActionType extends AbstractType
|
||||
'required' => false,
|
||||
'multiple' => true,
|
||||
'attr' => ['class' => 'select2'],
|
||||
'label' => $this->translator->trans('person_admin.social_goal'),
|
||||
'choice_label' => fn (Goal $g) => $this->translatableStringHelper->localize($g->getTitle()),
|
||||
])
|
||||
|
||||
@@ -82,6 +77,7 @@ class SocialActionType extends AbstractType
|
||||
'required' => false,
|
||||
'multiple' => true,
|
||||
'attr' => ['class' => 'select2'],
|
||||
'label' => $this->translator->trans('person_admin.social_evaluation'),
|
||||
'choice_label' => fn (Evaluation $e) => $this->translatableStringHelper->localize($e->getTitle()),
|
||||
])
|
||||
|
||||
|
Reference in New Issue
Block a user