src/Form/VacancyFormType.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  5. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  6. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  7. use Symfony\Component\Form\Extension\Core\Type\FileType;
  8. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  9. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  10. use Symfony\Component\Form\Extension\Core\Type\TextType;
  11. use Symfony\Component\Form\FormBuilderInterface;
  12. use Symfony\Component\OptionsResolver\OptionsResolver;
  13. use Symfony\Component\Validator\Constraints\File;
  14. class VacancyFormType extends AbstractType
  15. {
  16.     /**
  17.      * @inheritDoc
  18.      */
  19.     public function buildForm(FormBuilderInterface $builder, array $options)
  20.     {
  21.         $allowedMimeTypesCV = [
  22.             'image/gif',
  23.             'image/jpeg',
  24.             'image/pjpeg',
  25.             'image/png',
  26.             'application/msword',
  27.             'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
  28.             'application/pdf'
  29.         ];
  30.         $builder
  31.             ->add('firstname'TextType::class, [
  32.                 'label'       => 'Voornaam',
  33.                 'required'    => true
  34.             ])
  35.             ->add('lastname'TextType::class, [
  36.                 'label'    => 'Naam',
  37.                 'required' => true
  38.             ])
  39.             ->add('email'EmailType::class, [
  40.                 'label'    => 'E-Mail',
  41.                 'required' => true,
  42.                 'attr'     => [
  43.                     'placeholder' => 'example@example.com'
  44.                 ]
  45.             ])
  46.             ->add('phone'TextType::class, [
  47.                 'label'    => 'Telefoon',
  48.                 'required' => true
  49.             ])
  50.             ->add('country'TextType::class, [
  51.                 'label'    => 'Land',
  52.                 'required' => true
  53.             ])
  54.             ->add('curriculumvitea'FileType::class, [
  55.                 'label'    => 'Cv',
  56.                 'required' => true,
  57.                 'attr'     => [
  58.                     'accept' => implode(','$allowedMimeTypesCV)
  59.                 ],
  60.                 'constraints' => [
  61.                     new File([
  62.                         'maxSize' => '2M'//2M - 2k
  63.                         'mimeTypes' => $allowedMimeTypesCV
  64.                     ])
  65.                 ]
  66.             ])
  67. //            ->add('weekend_werk', CheckboxType::class, [
  68. //                'label'    => 'Ik sta open voor werken in het weekend.',
  69. //                'required' => true
  70. //            ])
  71.             ->add('message'TextareaType::class, [
  72.                 'label'    => 'Bericht',
  73.                 'required' => true
  74.             ])
  75.             ->add('conditions'CheckboxType::class, [
  76.                 'label'    => 'Conditions',
  77.                 'required' => true
  78.             ])
  79.             ->add('submit'SubmitType::class, [
  80.                 'label' => 'Verzenden'
  81.             ]);
  82.     }
  83.     /**
  84.      * @inheritDoc
  85.      */
  86.     public function configureOptions(OptionsResolver $resolver)
  87.     {
  88.     }
  89. }