<?php
namespace App\Form;
use App\Entity\Contact;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
class ContactType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('civilite', ChoiceType::class, [
"attr" => array (
"class" => "form-control",
'required' => true,
),
'choices' => [
'Mademoiselle' => 'Mademoiselle',
'Madame' => 'Madame',
'Monsieur' => 'Monsieur',
],
])
->add('nom', TextType::class, [
"attr" => array (
"class" => "form-control",
'required' => true,
)
])
->add('email', EmailType::class, [
"attr" => array (
"class" => "form-control",
'required' => true,
)
])
->add('telephone', TextType::class, [
"attr" => array (
"class" => "form-control",
'required' => true,
)
])
->add('objet', TextType::class, [
"attr" => array (
"class" => "form-control",
'required' => true,
)
])
->add('message', TextareaType::class, [
"attr" => array (
"class" => "form-control",
'required' => true,
)
])
->add('requete', ChoiceType::class, [
"attr" => array (
'required' => true,
),
'choices' => [
'Recontactez-moi' => 'Recontactez-moi',
'Demande de documentation' => 'Demande de documentation',
],
'expanded' => true
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Contact::class,
]);
}
}