<?php
namespace App\Form\Type\Frontend;
use App\Form\Type\EWZRecaptchaCustomType;
use Symfony\Component\Form\AbstractType;
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\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
class SaleAutoProType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('companyName', TextType::class, [
'label' => 'frontend.landing.sale-auto-pro.form.label.company_name',
'constraints' => [
new NotBlank(),
],
])
->add('lastname', TextType::class, [
'label' => 'frontend.landing.sale-auto-pro.form.label.lastname',
'constraints' => [
new NotBlank(),
],
])
->add('function', ChoiceType::class, [
'label' => 'frontend.landing.sale-auto-pro.form.label.function',
'required' => false,
'choices' => [
'frontend.landing.sale-auto-pro.form.business_role.choices.acheteur' => 'Acheteur',
'frontend.landing.sale-auto-pro.form.business_role.choices.administratif' => 'Administratif',
'frontend.landing.sale-auto-pro.form.business_role.choices.chef_ventes_vo' => 'Chef des ventes VO',
'frontend.landing.sale-auto-pro.form.business_role.choices.comptabilite' => 'Comptabilité',
'frontend.landing.sale-auto-pro.form.business_role.choices.gerant' => 'GĂ©rant',
'frontend.landing.sale-auto-pro.form.business_role.choices.vendeur' => 'Vendeur',
'frontend.landing.sale-auto-pro.form.business_role.choices.other' => 'Autre',
],
])
->add('tel', TextType::class, [
'label' => 'frontend.landing.sale-auto-pro.form.label.tel',
'constraints' => [
new NotBlank(),
],
])
->add('email', EmailType::class, [
'label' => 'frontend.landing.sale-auto-pro.form.label.email',
'constraints' => [
new NotBlank(),
new Email(),
],
])
->add('message', TextareaType::class, [
'label' => 'frontend.landing.sale-auto-pro.form.label.message',
'constraints' => [
new NotBlank(),
new Length(['min' => 10]),
],
])
->add('recaptcha', EWZRecaptchaCustomType::class)
->add('send', SubmitType::class, [
'label' => 'frontend.landing.sale-auto-pro.form.label.submit',
'attr' => [
'class' => 'lien14 bg04',
],
])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'translation_domain' => 'landing',
]);
}
}