src/Form/DemandeformationFormType.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\Demandeformations;
  4. use Symfony\Component\Form\AbstractType;
  5. use FOS\CKEditorBundle\Form\Type\CKEditorType;
  6. use Symfony\Component\Form\FormBuilderInterface;
  7. use Symfony\Component\Validator\Constraints\File;
  8. use Symfony\Component\OptionsResolver\OptionsResolver;
  9. use Symfony\Component\Form\Extension\Core\Type\UrlType;
  10. use Symfony\Component\Form\Extension\Core\Type\FileType;
  11. use Symfony\Component\Form\Extension\Core\Type\TextType;
  12. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  13. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  14. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  15. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  16. use Karser\Recaptcha3Bundle\Form\Recaptcha3Type;
  17. use Karser\Recaptcha3Bundle\Validator\Constraints\Recaptcha3;
  18. class DemandeformationFormType extends AbstractType
  19. {
  20.     public function buildForm(FormBuilderInterface $builder, array $options): void
  21.     {
  22.         $builder
  23.         ->add('theme'TextType::class, [
  24.             'required' => true,
  25.             'attr' => [
  26.                 'class' => 'form-control',
  27.             ],
  28.             'label' => "Thème de la formation souhaité"])
  29.         ->add('lieu'TextType::class, [
  30.             'required' => true,
  31.             'attr' => [
  32.                 'class' => 'form-control mt-1 mb-1',
  33.                 'minlenght' => '2',
  34.                 'maxlenght' => '100'
  35.             ],
  36.             'label' => "Lieu de la formation souhaité"])
  37.         ->add('duree'TextType::class, [
  38.             'required' => true,
  39.             'attr' => [
  40.                 'class' => 'form-control mt-1 mb-1',
  41.                 'minlenght' => '2',
  42.                 'maxlenght' => '100'
  43.             ],
  44.             'label' => "Date de la formation souhaitée"])
  45.             
  46.         ->add('nombrepart'TextType::class, [
  47.             'required' => true,
  48.             'attr' => [
  49.                 'class' => 'form-control mt-1 mb-1',
  50.                 'minlenght' => '2',
  51.                 'maxlenght' => '100'
  52.             ],
  53.             'label' => "Nombre de participants"])    
  54.         ->add('fonction'TextType::class, [
  55.             'required' => true,
  56.             'attr' => [
  57.                 'class' => 'form-control mt-1 mb-1',
  58.             ],
  59.             'label' => "Fonction"])
  60.         ->add('nom'TextType::class, [
  61.             'required' => true,
  62.             'attr' => [
  63.                 'class' => 'form-control mt-1 mb-1',
  64.             ],
  65.             'label' => "Nom"])
  66.         ->add('prenoms'TextType::class, [
  67.             'required' => true,
  68.             'attr' => [
  69.                 'class' => 'form-control mt-1 mb-1',
  70.             ],
  71.             'label' => "Prénoms"])
  72.       
  73.         ->add('mail'EmailType::class, [
  74.             'required' => true,
  75.             'attr' => [
  76.                 'class' => 'form-control mt-1 mb-1',
  77.                 'minlenght' => '2',
  78.                 'maxlenght' => '100'
  79.             ],
  80.             'label' => "Adresse email"])
  81.         ->add('entreprise'TextType::class, [
  82.             'required' => true,
  83.             'attr' => [
  84.                 'class' => 'form-control mt-1 mb-1',
  85.             ],
  86.             'label' => "Entreprise ou Projet de Financement"])
  87.         ->add('siteweb'UrlType::class, [
  88.             'required' => true,
  89.             'attr' => [
  90.                 'class' => 'form-control mt-1 mb-1',
  91.             ],
  92.             'label' => "Site Web de votre Entreprise"])
  93.         ->add('telephone'TextType::class, [
  94.             'required' => true,
  95.             'attr' => [
  96.                 'class' => 'form-control mt-1 mb-1',
  97.             ],
  98.             'label' => "Numéro de téléphone"])
  99.           
  100.         ->add('adresse'TextType::class, [
  101.             'required' => true,
  102.             'attr' => [
  103.                 'class' => 'form-control mt-1 mb-1',
  104.             ],
  105.             'label' => "Adresse"])    
  106.         ->add('commentaire'TextareaType::class, [
  107.             'required' => true,
  108.             'attr' => [
  109.                 'class' => 'form-control textarea',
  110.             ],
  111.             'label' => "Commentaire"])
  112.         ->add('captcha'Recaptcha3Type::class, [
  113.             'constraints' => new Recaptcha3(),
  114.             'action_name' => 'contact',
  115.                 'constraints' => new Recaptcha3 ([
  116.                 'message' => 'karser_recaptcha3.message',
  117.                 'messageMissingValue' => 'karser_recaptcha3.message_missing_value',
  118.             ]),
  119.         ])  
  120.  
  121.         ->add('submit'SubmitType::class, [
  122.             'attr' => [
  123.                'class' => 'btn btn-primary btn-large',
  124.                'style' =>'font-family: arial'
  125.            ],
  126.             'label' => 'Demander un dévis']);
  127.         // ...
  128.     }
  129.     
  130.     public function configureOptions(OptionsResolver $resolver): void
  131.     {
  132.         $resolver->setDefaults([
  133.             'data_class' => Demandeformations::class,
  134.         ]);
  135.     }
  136. }