src/Form/ContactType.php line 16

  1. <?php
  2. namespace App\Form;
  3. use Symfony\Component\Form\AbstractType;
  4. use Gregwar\CaptchaBundle\Type\CaptchaType;
  5. use Symfony\Component\Form\FormBuilderInterface;
  6. use Symfony\Component\OptionsResolver\OptionsResolver;
  7. use Symfony\Component\Form\Extension\Core\Type\TextType;
  8. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  9. use Symfony\Component\Form\Extension\Core\Type\ResetType;
  10. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  11. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  12. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  13. class ContactType extends AbstractType
  14. {
  15.     public function buildForm(FormBuilderInterface $builder, array $options): void
  16.     {
  17.         $builder
  18.             ->add('nom'TextType::class, [
  19.                 'label' => false,
  20.                 'attr' => [
  21.                     'class' => 'form-control form-contact',
  22.                     'placeholder' => 'Votre nom *',
  23.                     'style' => 'font-size: 0.9rem;'
  24.                 ]
  25.             ])
  26.             ->add('prenom'TextType::class, [
  27.                 'label' => false,
  28.                 'attr' => [
  29.                     'class' => 'form-control form-contact',
  30.                     'placeholder' => 'Votre prénom *',
  31.                     'style' => 'font-size: 0.9rem;'
  32.                 ]
  33.             ])
  34.             ->add('telephone'TextType::class, [
  35.                 'label' => false,
  36.                 'required' => false,
  37.                 'attr' => [
  38.                     'class' => 'form-control form-contact',
  39.                     'placeholder' => 'Votre numéro de téléphone',
  40.                     'style' => 'font-size: 0.9rem;'
  41.                 ]
  42.             ])
  43.             ->add('email'EmailType::class, [
  44.                 'label' => false,
  45.                 'required' => false,
  46.                 'attr' => [
  47.                     'class' => 'form-control form-contact',
  48.                     'placeholder' => 'Votre email *',
  49.                     'style' => 'font-size: 0.9rem;'
  50.                 ]
  51.             ])
  52.             ->add('sujet'TextType::class, [
  53.                 'label' => false,
  54.                 'attr' => [
  55.                     'class' => 'form-control form-contact',
  56.                     'placeholder' => 'Objet de votre demande *',
  57.                     'style' => 'font-size: 0.9rem;'
  58.                 ]
  59.             ])
  60.             ->add('message'TextareaType::class, [
  61.                 'label' => false,
  62.                 'attr' => [
  63.                     'class' => 'form-control form-contact',
  64.                     'rows' => 8,
  65.                     'placeholder' => 'Message *',
  66.                     'style' => 'font-size: 0.9rem;'
  67.                 ]
  68.             ])
  69.             ->add('captcha'CaptchaType::class, [
  70.                 'label' => false,
  71.                 'length' => 6,
  72.                 'width' => 200,
  73.                 'height' => 45,
  74.                 // 'as_url' => true,
  75.                 // 'reload' => true,
  76.                 'attr' => [
  77.                     'style' => 'width: 200px',
  78.                     'class' => 'form-control'
  79.                 ]
  80.             ])
  81.         ;
  82.     }
  83.     public function configureOptions(OptionsResolver $resolver): void
  84.     {
  85.         $resolver->setDefaults([
  86.             // Configure your form options here
  87.         ]);
  88.     }
  89. }