Change PickGenderType form field to use in Person creation form

This commit is contained in:
2024-09-26 13:24:30 +02:00
parent b78f0980f5
commit 67a6eb17db
10 changed files with 69 additions and 104 deletions

View File

@@ -3,6 +3,7 @@
namespace Chill\MainBundle\Form;
use Chill\MainBundle\Entity\Gender;
use Chill\MainBundle\Entity\GenderEnum;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
@@ -20,11 +21,11 @@ class GenderType extends AbstractType
'required' => true,
])
->add('icon', TextType::class)
->add('isGrammatical', ChoiceType::class, [
'choices' => [
'Grammatical' => true,
'Not grammatical' => false,
],
->add('genderTranslation', ChoiceType::class, [
'choices' => GenderEnum::cases(),
'choice_label' => fn(GenderEnum $enum) => ucfirst(strtolower($enum->name)),
'choice_value' => fn(?GenderEnum $enum) => $enum ? $enum->value : null,
'data_class' => null,
])
->add('active', ChoiceType::class, [
'choices' => [