src/Form/JobFormType.php line 19

  1. <?php
  2. namespace App\Form;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\Extension\Core\Type\TextType;
  5. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  6. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  7. use Symfony\Component\Form\FormBuilderInterface;
  8. use Symfony\Component\OptionsResolver\OptionsResolver;
  9. use Symfony\Component\Validator\Constraints\NotBlank;
  10. use Symfony\Component\Validator\Constraints\Email;
  11. use Karser\Recaptcha3Bundle\Form\Recaptcha3Type;
  12. use Karser\Recaptcha3Bundle\Validator\Constraints\Recaptcha3;
  13. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  14. use Symfony\Component\Form\Extension\Core\Type\FileType;
  15. use Symfony\Component\Validator\Constraints\File;
  16. class JobFormType extends AbstractType
  17. {
  18.     public function buildForm(FormBuilderInterface $builder, array $options): void
  19.     {
  20.         $builder
  21.             ->add('lastname'TextType::class, [
  22.                 'label' => false,
  23.                 'required' => true,
  24.                 'attr' => [
  25.                     'class' => 'form-control',
  26.                     'placeholder' => 'form.contact.lastname.placeholder'
  27.                 ]
  28.             ])
  29.             ->add('firstname'TextType::class, [
  30.                 'label' => false,
  31.                 'required' => true,
  32.                 'attr' => [
  33.                     'class' => 'form-control',
  34.                     'placeholder' => 'form.job.prenom.placeholder'
  35.                 ]
  36.             ])
  37.             ->add('email'EmailType::class, [
  38.                 'label' => false,
  39.                 'required' => true,
  40.                 'attr' => [
  41.                     'class' => 'form-control',
  42.                     'placeholder' => 'form.contact.email.placeholder'
  43.                 ]
  44.             ])
  45.             ->add('phone'TextType::class, [
  46.                 'label' => false,
  47.                 'required' => true,
  48.                 'attr' => [
  49.                     'class' => 'form-control',
  50.                     'placeholder' => 'form.contact.phone.placeholder'
  51.                 ]
  52.             ])
  53.             ->add('motivation'TextareaType::class, [
  54.                 'label' => false,
  55.                 'required' => true,
  56.                 'attr' => [
  57.                     'class' => 'form-control',
  58.                     'placeholder' => 'form.contact.motivation.placeholder'
  59.                 ]
  60.             ])/*permet d'ajouter un pdf avec le mail*/
  61.             ->add('cv'FileType::class, [
  62.                 'label' => false,
  63.                 'required' => true,
  64.                 'attr' => [
  65.                     'class' => 'form-control',
  66.                     'placeholder' => 'Votre CV (PDF)',
  67.                     'accept' => 'application/pdf,.pdf'
  68.                 ],
  69.                 'constraints' => [
  70.                     new File([
  71.                         'maxSize' => '5M',
  72.                         'mimeTypes' => [
  73.                             'application/pdf',
  74.                         ],
  75.                         'mimeTypesMessage' => 'Veuillez télécharger un fichier PDF valide',
  76.                     ])
  77.                 ]
  78.             ])
  79.             
  80.             /*
  81.             ->add('captcha', Recaptcha3Type::class, [
  82.                 'constraints' => new Recaptcha3(),
  83.                 'action_name' => 'app_home',
  84.                 'locale' => 'fr',
  85.             ])
  86.             */
  87.         ;
  88.     }
  89.     public function configureOptions(OptionsResolver $resolver): void
  90.     {
  91.         $resolver->setDefaults([
  92.             // Configure your form options here
  93.         ]);
  94.     }
  95. }