src/Form/FicheProspectType.php line 21

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4.  * Copyright (C) Office National de Publication et de Communication - All Rights Reserved
  5.  *
  6.  * Unauthorized copying of this file, via any medium is strictly prohibited by law
  7.  * This file is proprietary and confidential
  8.  */
  9. namespace App\Form;
  10. use App\Entity\FicheProspect;
  11. use Symfony\Component\Form\AbstractType;
  12. use Gregwar\CaptchaBundle\Type\CaptchaType;
  13. use Symfony\Component\Form\FormBuilderInterface;
  14. use Symfony\Component\OptionsResolver\OptionsResolver;
  15. use Symfony\Component\Form\Extension\Core\Type\TextType;
  16. final class FicheProspectType extends AbstractType
  17. {
  18.     public function buildForm(FormBuilderInterface $builder, array $options): void
  19.     {
  20.         $builder
  21.             ->add('nom')
  22.             ->add('adresse')
  23.             ->add('codePostal')
  24.             ->add('ville')
  25.             ->add('telephone')
  26.             ->add('email')
  27.             /* Honeypot : */
  28.             ->add('email2'TextType::class,
  29.             [
  30.                 'required' => false,
  31.                 'mapped' => false,
  32.                 'label' => false,
  33.                 'attr' => [
  34.                     'style' => 'display:none !important',
  35.                     'tabindex' => '-1',
  36.                     'autocomplete' => 'off',
  37.                 ],
  38.             ])
  39.             ->add('siteWeb')
  40.             ->add('responsable')
  41.             ->add('categorie')
  42.             ->add('description')
  43.             ->add('captcha'CaptchaType::class, [
  44.                 'mapped' => false,
  45.                 'width' => 150,
  46.                 'height' => 60,
  47.                 'length' => 4,
  48.                 'invalid_message' => 'Merci de saisir le bon code anti-robot !',
  49.                 'distortion' => false,
  50.                 'background_color' => [255255255]
  51.             ])
  52.             ->add('autoriseContact');
  53.     }
  54.     public function configureOptions(OptionsResolver $resolver): void
  55.     {
  56.         $resolver->setDefaults([
  57.             'data_class' => FicheProspect::class,
  58.         ]);
  59.     }
  60. }