<?php
namespace App\Form\Type;
use App\Entity\Contact;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
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 Gregwar\CaptchaBundle\Type\CaptchaType;
class ContactType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('pseudo', TextType::class, [
'label' => 'Pseudo'
])
->add('title', TextType::class, [
'label' => 'Titre du message'
])
->add('emailFrom', EmailType::class, [
'label' => 'Email afin de vous répondre'
])
->add('Content', TextareaType::class, [
'attr' => array('rows' => '5'),
'label' => 'Contenu de votre message'
])
->add('captcha', CaptchaType::class)
->add('Envoyer', SubmitType::class)
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Contact::class,
]);
}
}