wip: use GenderIconEnum to allow user to select bootstrap icon

This commit is contained in:
2024-09-26 15:45:44 +02:00
parent 67a6eb17db
commit 567c01f395
6 changed files with 30 additions and 13 deletions

View File

@@ -4,6 +4,7 @@ namespace Chill\MainBundle\Form;
use Chill\MainBundle\Entity\Gender;
use Chill\MainBundle\Entity\GenderEnum;
use Chill\MainBundle\Entity\GenderIconEnum;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
@@ -20,7 +21,13 @@ class GenderType extends AbstractType
->add('label', TranslatableStringFormType::class, [
'required' => true,
])
->add('icon', TextType::class)
->add('icon', ChoiceType::class, [
'choices' => GenderIconEnum::cases(),
'expanded' => true,
'multiple' => false,
'mapped' => true,
'label' => 'Select Gender Icon',
])
->add('genderTranslation', ChoiceType::class, [
'choices' => GenderEnum::cases(),
'choice_label' => fn(GenderEnum $enum) => ucfirst(strtolower($enum->name)),