<?php
namespace App\Form\App;
use App\Entity\App\Contact;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class ContactType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name', TextType::class, [
'label' => "Nom d'utlisateur",
'attr' => [
'class' => 'form-field form-input',
],
])
->add(
'email',
EmailType::class,
[
'label' => 'Adresse e-mail',
'attr' => [
'class' => 'form-field form-input',
],
]
)
->add(
'object',
TextType::class,
[
'label' => 'Objet',
'attr' => [
'class' => 'form-field form-input',
],
]
)
->add(
'message',
TextareaType::class,
[
'label' => 'Message',
'attr' => [
'class' => 'form-field form-input',
],
]
)
->add('category', ChoiceType::class, [
'choices' => [
'SAV' => 0,
'Personnalisation' => 1,
],
'label' => 'Catégorie',
'attr' => [
'class' => 'form-field form-input',
],
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Contact::class,
]);
}
}