src/Form/InscriptionFormType.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\Inscriptions;
  4. use Symfony\Component\Form\AbstractType;
  5. use Gregwar\CaptchaBundle\Type\CaptchaType;
  6. use FOS\CKEditorBundle\Form\Type\CKEditorType;
  7. use Symfony\Component\Form\FormBuilderInterface;
  8. use Symfony\Component\Validator\Constraints\File;
  9. use Symfony\Component\OptionsResolver\OptionsResolver;
  10. use Symfony\Component\Form\Extension\Core\Type\UrlType;
  11. use Symfony\Component\Form\Extension\Core\Type\FileType;
  12. use Symfony\Component\Form\Extension\Core\Type\TextType;
  13. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  14. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  15. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  16. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  17. class InscriptionFormType extends AbstractType
  18. {
  19.     public function buildForm(FormBuilderInterface $builder, array $options): void
  20.     {
  21.         $builder
  22.         
  23.         ->add('civilite'ChoiceType::class, [
  24.             'mapped' => false,
  25.             'attr' => [
  26.                 'class' => 'form-control',
  27.             ],
  28.             'choices'  => [
  29.                 // 'choix du rôle de l\'utilisateur' => 'choix',
  30.                 'Monsieur' => 'M.',
  31.                 'Madame' => 'Mme',
  32.                 'Mademoiselle' => 'Mselle',
  33.             ],
  34.             'label' => "Civilité"])
  35.         
  36.         ->add('nom'TextType::class, [
  37.             'required' => true,
  38.             'attr' => [
  39.                 'class' => 'form-control',
  40.             ],
  41.             'label' => "Nom"])
  42.         ->add('prenoms'TextType::class, [
  43.             'required' => true,
  44.             'attr' => [
  45.                 'class' => 'form-control mt-1 mb-1',
  46.                 'minlenght' => '2',
  47.                 'maxlenght' => '100'
  48.             ],
  49.             'label' => "Prénoms"])
  50.         ->add('fonction'TextType::class, [
  51.             'required' => true,
  52.             'attr' => [
  53.                 'class' => 'form-control mt-1 mb-1',
  54.                 'minlenght' => '2',
  55.                 'maxlenght' => '100'
  56.             ],
  57.             'label' => "Fonction"])
  58.             
  59.         ->add('telephone'TextType::class, [
  60.             'required' => true,
  61.             'attr' => [
  62.                 'class' => 'form-control mt-1 mb-1',
  63.                 'minlenght' => '2',
  64.                 'maxlenght' => '100'
  65.             ],
  66.             'label' => "Téléphone"])    
  67.             
  68.         ->add('mail'EmailType::class, [
  69.             'required' => true,
  70.             'attr' => [
  71.                 'class' => 'form-control mt-1 mb-1',
  72.                 'minlenght' => '2',
  73.                 'maxlenght' => '100'
  74.             ],
  75.             'label' => "Adresse email"])
  76.         ->add('entreprise'TextType::class, [
  77.             'required' => true,
  78.             'attr' => [
  79.                 'class' => 'form-control mt-1 mb-1',
  80.             ],
  81.             'label' => "Entreprise ou Projet de Financement"])
  82.         ->add('siteweb'UrlType::class, [
  83.             'required' => true,
  84.             'attr' => [
  85.                 'class' => 'form-control mt-1 mb-1',
  86.             ],
  87.             'label' => "Site Web de votre Entreprise"])
  88.         ->add('nbparticipant'TextType::class, [
  89.             'required' => true,
  90.             'attr' => [
  91.                 'class' => 'form-control mt-1 mb-1',
  92.             ],
  93.             'label' => "Nombre de participants"])
  94.         ->add('pays'TextType::class, [
  95.             'required' => true,
  96.             'attr' => [
  97.                 'class' => 'form-control mt-1 mb-1',
  98.             ],
  99.             'label' => "Pays"])
  100.         ->add('ville'TextType::class, [
  101.             'required' => true,
  102.             'attr' => [
  103.                 'class' => 'form-control mt-1 mb-1',
  104.             ],
  105.             'label' => "Ville"])
  106.             
  107.         ->add('boitepostale'TextType::class, [
  108.             'required' => true,
  109.             'attr' => [
  110.                 'class' => 'form-control mt-1 mb-1',
  111.             ],
  112.             'label' => "Boite postale"])    
  113.             
  114.         ->add('whatsapp'TextType::class, [
  115.             'required' => true,
  116.             'attr' => [
  117.                 'class' => 'form-control mt-1 mb-1',
  118.             ],
  119.             'label' => "Whatsapp"])             
  120.             
  121.         ->add('adresse'TextType::class, [
  122.             'required' => true,
  123.             'attr' => [
  124.                 'class' => 'form-control mt-1 mb-1',
  125.             ],
  126.             'label' => "Adresse"])    
  127.         ->add('commentaire'TextareaType::class, [
  128.             'required' => true,
  129.             'attr' => [
  130.                 'class' => 'form-control textarea',
  131.             ],
  132.             'label' => "Commentaire"])
  133.         ->add('captcha'CaptchaType::class, [
  134.             'required' => true,
  135.             'label' => 'Saisissez le texte ci-dessus',
  136.             'attr' => [
  137.                 'class' => 'form-control mb-1 captcha',
  138.                 'style' =>'width: 100%'
  139.             ],]);
  140.         /*
  141.         ->add('submit', SubmitType::class, [
  142.             'attr' => [
  143.                'class' => 'btn btn-primary btn-large'
  144.            ],
  145.             'label' => 'Enregistrer']);
  146.         */
  147.         // ...
  148.     }
  149.     
  150.     public function configureOptions(OptionsResolver $resolver): void
  151.     {
  152.         $resolver->setDefaults([
  153.             'data_class' => Inscriptions::class,
  154.         ]);
  155.     }
  156. }