src/Form/Type/Frontend/RecruitmentApplyType.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Form\Type\Frontend;
  3. use App\Form\Type\EWZRecaptchaCustomType;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  6. use Symfony\Component\Form\Extension\Core\Type\FileType;
  7. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  8. use Symfony\Component\Form\Extension\Core\Type\TextType;
  9. use Symfony\Component\Form\FormBuilderInterface;
  10. use Symfony\Component\Validator\Constraints\Email;
  11. use Symfony\Component\Validator\Constraints\Length;
  12. use Symfony\Component\Validator\Constraints\NotBlank;
  13. class RecruitmentApplyType extends AbstractType
  14. {
  15.     public function buildForm(FormBuilderInterface $builder, array $options): void
  16.     {
  17.         $builder
  18.             ->add('lastName'TextType::class, [
  19.                 'label' => 'frontend.wiki.recruitment_apply.last_name',
  20.                 'constraints' => [
  21.                     new NotBlank(),
  22.                     new Length(['min' => 3]),
  23.                 ],
  24.             ])
  25.             ->add('firstName'TextType::class, [
  26.                 'label' => 'frontend.wiki.recruitment_apply.first_name',
  27.                 'constraints' => [
  28.                     new NotBlank(),
  29.                     new Length(['min' => 3]),
  30.                 ],
  31.             ])
  32.             ->add('email'EmailType::class, [
  33.                 'label' => 'frontend.wiki.recruitment_apply.email',
  34.                 'constraints' => [
  35.                     new NotBlank(),
  36.                     new Email(),
  37.                 ],
  38.             ])
  39.             ->add('job'TextType::class, [
  40.                 'label' => 'frontend.wiki.recruitment_apply.job',
  41.                 'constraints' => [
  42.                     new NotBlank(),
  43.                     new Length(['min' => 3]),
  44.                 ],
  45.             ])
  46.             ->add('message'TextareaType::class, [
  47.                 'label' => 'frontend.wiki.recruitment_apply.message',
  48.                 'required' => true,
  49.             ])
  50.             ->add('cv'FileType::class, [
  51.                 'required' => true,
  52.                 'label' => 'frontend.wiki.recruitment_apply.cv',
  53.                 'attr' => [
  54.                     'accept' => 'application/pdf',
  55.                     'class' => 'input-file-recruitment',
  56.                 ],
  57.             ])
  58.             ->add('coverLetter'FileType::class, [
  59.                 'required' => false,
  60.                 'label' => 'frontend.wiki.recruitment_apply.coverLetter',
  61.                 'attr' => [
  62.                     'accept' => 'application/pdf',
  63.                     'class' => 'input-file-recruitment',
  64.                 ],
  65.             ])
  66.             ->add('recaptcha'EWZRecaptchaCustomType::class);
  67.     }
  68.     public function getBlockPrefix(): string
  69.     {
  70.         return 'vp_auto_frontend_recruitment_apply';
  71.     }
  72. }