<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\File;
class VacancyFormType extends AbstractType
{
/**
* @inheritDoc
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$allowedMimeTypesCV = [
'image/gif',
'image/jpeg',
'image/pjpeg',
'image/png',
'application/msword',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/pdf'
];
$builder
->add('firstname', TextType::class, [
'label' => 'Voornaam',
'required' => true
])
->add('lastname', TextType::class, [
'label' => 'Naam',
'required' => true
])
->add('email', EmailType::class, [
'label' => 'E-Mail',
'required' => true,
'attr' => [
'placeholder' => 'example@example.com'
]
])
->add('phone', TextType::class, [
'label' => 'Telefoon',
'required' => true
])
->add('country', TextType::class, [
'label' => 'Land',
'required' => true
])
->add('curriculumvitea', FileType::class, [
'label' => 'Cv',
'required' => true,
'attr' => [
'accept' => implode(',', $allowedMimeTypesCV)
],
'constraints' => [
new File([
'maxSize' => '2M', //2M - 2k
'mimeTypes' => $allowedMimeTypesCV
])
]
])
// ->add('weekend_werk', CheckboxType::class, [
// 'label' => 'Ik sta open voor werken in het weekend.',
// 'required' => true
// ])
->add('message', TextareaType::class, [
'label' => 'Bericht',
'required' => true
])
->add('conditions', CheckboxType::class, [
'label' => 'Conditions',
'required' => true
])
->add('submit', SubmitType::class, [
'label' => 'Verzenden'
]);
}
/**
* @inheritDoc
*/
public function configureOptions(OptionsResolver $resolver)
{
}
}