src/Form/Type/ContactType.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Form\Type;
  3. use App\Entity\Contact;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  6. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  7. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  8. use Symfony\Component\Form\Extension\Core\Type\TextType;
  9. use Symfony\Component\Form\FormBuilderInterface;
  10. use Symfony\Component\OptionsResolver\OptionsResolver;
  11. use Gregwar\CaptchaBundle\Type\CaptchaType;
  12. class ContactType extends AbstractType
  13. {
  14.     public function buildForm(FormBuilderInterface $builder, array $options): void
  15.     {
  16.         $builder
  17.             ->add('pseudo'TextType::class, [
  18.                 'label' => 'Pseudo'
  19.             ])
  20.             ->add('title'TextType::class, [
  21.                 'label' => 'Titre du message'
  22.             ])
  23.             ->add('emailFrom'EmailType::class, [
  24.                 'label' => 'Email afin de vous rĂ©pondre'
  25.             ])
  26.             ->add('Content'TextareaType::class, [
  27.                 'attr' => array('rows' => '5'),
  28.                 'label' => 'Contenu de votre message'
  29.             ])
  30.             ->add('captcha'CaptchaType::class)
  31.             ->add('Envoyer'SubmitType::class)
  32.         ;
  33.     }
  34.     public function configureOptions(OptionsResolver $resolver): void
  35.     {
  36.         $resolver->setDefaults([
  37.             'data_class' => Contact::class,
  38.         ]);
  39.     }
  40. }