src/Form/NewInscriptionFormType.php line 24

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\Thematiques;
  4. use App\Entity\Themes;
  5. use App\Entity\Villes;
  6. use App\Entity\Inscriptions;
  7. use Symfony\Component\Form\AbstractType;
  8. use Gregwar\CaptchaBundle\Type\CaptchaType;
  9. use FOS\CKEditorBundle\Form\Type\CKEditorType;
  10. use Symfony\Component\Form\FormBuilderInterface;
  11. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  12. use Symfony\Component\Validator\Constraints\File;
  13. use Symfony\Component\OptionsResolver\OptionsResolver;
  14. use Symfony\Component\Form\Extension\Core\Type\UrlType;
  15. use Symfony\Component\Form\Extension\Core\Type\FileType;
  16. use Symfony\Component\Form\Extension\Core\Type\TextType;
  17. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  18. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  19. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  20. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  21. class NewInscriptionFormType extends AbstractType
  22. {
  23.     public function buildForm(FormBuilderInterface $builder, array $options): void
  24.     {
  25.         $builder
  26.         ->add('nom'TextType::class, [
  27.             'required' => true,
  28.             'attr' => [
  29.                 'class' => 'form-control',
  30.             ],
  31.             'label' => "Nom"])
  32.         ->add('prenoms'TextType::class, [
  33.             'required' => true,
  34.             'attr' => [
  35.                 'class' => 'form-control mt-1 mb-1',
  36.                 'minlenght' => '2',
  37.                 'maxlenght' => '100'
  38.             ],
  39.             'label' => "Prénoms"])
  40.         ->add('fonction'TextType::class, [
  41.             'required' => true,
  42.             'attr' => [
  43.                 'class' => 'form-control mt-1 mb-1',
  44.                 'minlenght' => '2',
  45.                 'maxlenght' => '100'
  46.             ],
  47.             'label' => "Fonction"])
  48.             
  49.         ->add('telephone'TextType::class, [
  50.             'required' => true,
  51.             'attr' => [
  52.                 'class' => 'form-control mt-1 mb-1',
  53.                 'minlenght' => '2',
  54.                 'maxlenght' => '100'
  55.             ],
  56.             'label' => "Téléphone"])    
  57.             
  58.         ->add('mail'EmailType::class, [
  59.             'required' => true,
  60.             'attr' => [
  61.                 'class' => 'form-control mt-1 mb-1',
  62.                 'minlenght' => '2',
  63.                 'maxlenght' => '100'
  64.             ],
  65.             'label' => "Adresse email"])
  66.         ->add('entreprise'TextType::class, [
  67.             'required' => true,
  68.             'attr' => [
  69.                 'class' => 'form-control mt-1 mb-1',
  70.             ],
  71.             'label' => "Entreprise ou Projet de Financement"])
  72.         ->add('siteweb'UrlType::class, [
  73.             'required' => true,
  74.             'attr' => [
  75.                 'class' => 'form-control mt-1 mb-1',
  76.             ],
  77.             'label' => "Site Web de votre Entreprise"])
  78.         ->add('nbparticipant'TextType::class, [
  79.             'required' => true,
  80.             'attr' => [
  81.                 'class' => 'form-control mt-1 mb-1',
  82.             ],
  83.             'label' => "Nombre de participants"])
  84.         ->add('pays'TextType::class, [
  85.             'required' => true,
  86.             'attr' => [
  87.                 'class' => 'form-control mt-1 mb-1',
  88.             ],
  89.             'label' => "Pays"])
  90.         ->add('ville'TextType::class, [
  91.             'required' => true,
  92.             'attr' => [
  93.                 'class' => 'form-control mt-1 mb-1',
  94.             ],
  95.             'label' => "Ville"])
  96.             
  97.         ->add('boitepostale'TextType::class, [
  98.             'required' => true,
  99.             'attr' => [
  100.                 'class' => 'form-control mt-1 mb-1',
  101.             ],
  102.             'label' => "Boite postale"])    
  103.             
  104.         ->add('whatsapp'TextType::class, [
  105.             'required' => true,
  106.             'attr' => [
  107.                 'class' => 'form-control mt-1 mb-1',
  108.             ],
  109.             'label' => "Whatsapp"])             
  110.             
  111.         ->add('adresse'TextType::class, [
  112.             'required' => true,
  113.             'attr' => [
  114.                 'class' => 'form-control mt-1 mb-1',
  115.             ],
  116.             'label' => "Adresse"])    
  117.             
  118.         ->add('thematique'EntityType::class, [
  119.             'class' => Thematiques::class,
  120.             'choice_label' => 'nom',
  121.             'choice_value' => 'id',
  122.             'placeholder' => 'Sélectionner la thématique'// ✅ ici
  123.             'required' => true,
  124.             'mapped' => true,
  125.             'attr' => [
  126.                 'class' => 'form-control border-2 mt-1 mb-1 select2'
  127.             ],
  128.             'label' => false
  129.         ])
  130.     
  131.         ->add('theme'EntityType::class, [
  132.              'required' => true,
  133.              'mapped' => true,
  134.              'attr' => [
  135.                  'class' => 'form-control border-2 mt-1 mb-1 select2',
  136.              ],
  137.              'class' => Themes::class,
  138.              'placeholder' => 'Selectionner une thème',
  139.              'choice_label' => 'nom',
  140.              'choice_value' => 'id',
  141.              'label' => false])    
  142.  
  143.         
  144.         ->add('lieu'EntityType::class, [
  145.              'required' => true,
  146.              'mapped' => true,
  147.              'attr' => [
  148.                  'class' => 'form-control border-2 mt-1 mb-1 select2',
  149.              ],
  150.              'class' => Villes::class,
  151.              'placeholder' => 'Selectionner le lieu',
  152.              'choice_label' => 'nom',
  153.              'choice_value' => 'id',
  154.              'label' => false])  
  155.         
  156.         ->add('prix'TextType::class, [
  157.             'required' => true,
  158.             'attr' => [
  159.                 'class' => 'form-control mt-1 mb-1','placeholder' => 'Prix',
  160.             ],
  161.             'label' => false]) 
  162.             
  163.         ->add('periode'TextType::class, [
  164.             'required' => true,
  165.             'attr' => [
  166.                 'class' => 'form-control mt-1 mb-1','placeholder' => 'Période',
  167.             ],
  168.             'label' => false])   
  169.         ->add('commentaire'TextareaType::class, [
  170.             'required' => true,
  171.             'attr' => [
  172.                 'class' => 'form-control textarea',
  173.             ],
  174.             'label' => "Commentaire"])
  175.         ->add('captcha'CaptchaType::class, [
  176.             'required' => true,
  177.             'label' => 'Saisissez le texte ci-dessus',
  178.             'attr' => [
  179.                 'class' => 'form-control mb-1 captcha',
  180.                 'style' =>'width: 100%'
  181.             ],])
  182.  
  183.         ->add('submit'SubmitType::class, [
  184.             'attr' => [
  185.                'class' => 'btn btn-primary btn-large'
  186.            ],
  187.             'label' => 'Enregistrer']);
  188.         // ...
  189.     }
  190.     
  191.     public function configureOptions(OptionsResolver $resolver): void
  192.     {
  193.         $resolver->setDefaults([
  194.             'data_class' => Inscriptions::class,
  195.         ]);
  196.     }
  197. }