<?php
/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Enterprise License (PEL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PEL
*/
namespace App\Form;
use Pimcore\Localization\LocaleService;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\Validator\Constraints\File;
class WorkWithUsFormType extends AbstractType
{
/**
* @inheritDoc
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('firstname', TextType::class, [
'label' => 'Nome',
'attr' => ['class' => 'form-control col-sm-4'],
'required' => true,
])
->add('lastname', TextType::class, [
'label' => 'Cognome',
'attr' => ['class' => 'form-control col-sm-4'],
'required' => true,
])
->add('email', EmailType::class, [
'label' => 'Email',
'attr' => ['class' => 'form-control col-sm-4'],
'required' => true,
])
->add('city', TextType::class, [
'label' => 'Città ',
'attr' => ['class' => 'form-control col-sm-4'],
'required' => false,
])
->add('cap', TextType::class, [
'label' => 'CAP',
'attr' => ['class' => 'form-control col-sm-4'],
'required' => false,
])
->add('area_of_interest', TextType::class, [
'label' => 'Area di interesse',
'attr' => ['class' => 'form-control col-sm-4'],
'required' => false,
])
->add('filiale', TextType::class, [
'label' => 'Filiale',
'attr' => ['class' => 'form-control col-sm-4'],
'required' => false,
])
->add('phone', TextType::class, [
'label' => 'Telefono',
'attr' => ['class' => 'form-control col-sm-4'],
'required' => false,
])
->add('consent', CheckboxType::class, [
'label' => 'Contsent',
'attr' => ['class' => 'custom-control-input mr-2'],
'required' => true,
])
->add('file_upload', FileType::class, [
'label' => 'File',
'attr' => ['class' => 'custom-file-input'],
// unmapped means that this field is not associated to any entity property
'mapped' => false,
// make it optional so you don't have to re-upload the PDF file
// every time you edit the Product details
'required' => false,
// unmapped fields can't define their validation using annotations
// in the associated entity, so you can use the PHP constraint classes
'constraints' => [
new File([
'maxSize' => '5024k',
'mimeTypesMessage' => 'Caricare un documento valido',
])
],
])
->add('_target_path', HiddenType::class)
->add('_submit', SubmitType::class, [
'label' => 'Invia candidatura',
'attr' => ['class' => 'btn c-button yellow']
]);
}
/**
* @inheritDoc
*/
public function getBlockPrefix()
{
// we need to set this to an empty string as we want _username as input name
// instead of login_form[_username] to work with the form authenticator out
// of the box
return '';
}
/**
* @inheritDoc
*/
public function configureOptions(OptionsResolver $resolver)
{
}
}