<?php
namespace App\Form;
use App\Entity\Contact;
use Symfony\Component\Form\AbstractType;
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;
use Symfony\Component\Validator\Constraints\Email;
class ContactType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('fullName',TextType::class,[
'label'=>false,
'attr'=>[
'class'=>"form-control",
'id'=>'name',
'placeholder'=>'Votre nom'
]
])
->add('email', \Symfony\Component\Form\Extension\Core\Type\EmailType::class, [
'label'=>false,
'attr'=>[
'class'=>"form-control",
'id'=>'email',
'placeholder'=>'Votre Email'
]
])
->add('subject',TextType::class,[
'label'=>false,
'attr'=>[
'class'=>"form-control",
'id'=>'subjet',
'placeholder'=>'Objet'
]
])
->add('message', TextareaType::class,[
'label'=>false,
'attr'=>[
'class'=>"form-control",
'id'=>'message',
'placeholder'=>'Votre message'
]
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Contact::class,
]);
}
}