<?php
namespace App\Form;
use App\Model\ContactModel;
use Symfony\Component\Form\AbstractType;
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*',
'attr' => [
'data-type' => "nom"
]
])
->add('firstName', TextType::class, [
'label' => 'Prénom*',
'attr' => [
'data-type' => "prenom"
]
])
->add('street', TextType::class, [
'label' => 'Rue*',
'attr' => [
'data-type' => "rue"
]
])
->add('postalCode', TextType::class, [
'label' => 'Code postal*',
'attr' => [
'data-type' => "code_postal"
]
])
->add('city', TextType::class, [
'label' => 'Ville*',
'attr' => [
'data-type' => "ville"
]
])
->add('email', EmailType::class, [
'label' => 'Email*',
'attr' => [
'data-type' => "email"
]
])
->add('telephone', TextType::class, [
'label' => 'Téléphone*',
'attr' => [
'data-type' => "phone"
]
])
->add('message', TextareaType::class, [
'label' => 'Pour quelle raison bous solicitez-vous ?*',
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => ContactModel::class
]);
}
}