<?php
namespace App\Form;
use App\Model\ContactDTO;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TelType;
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;
class ContactType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('firstname', TextType::class, [
'attr' => [
'placeholder' => 'Prénom*',
'class' => 'mb-2',
'autocomplete' => 'noo'
],
'required' => false
])
->add('lastname', TextType::class, [
'attr' => [
'placeholder' => 'Nom*',
'class' => 'mb-2',
'autocomplete' => 'noo'
],
'required' => false
])
->add('phone', TelType::class, [
'attr' => [
'placeholder' => 'Téléphone ou GSM*',
'class' => 'mb-2',
'autocomplete' => 'noo'
],
'required' => false
])
->add('email', EmailType::class, [
'attr' => [
'placeholder' => 'Adresse mail*',
'class' => 'mb-2',
'autocomplete' => 'noo'
],
'required' => false
])
->add('message', TextareaType::class, [
'attr' => [
'placeholder' => 'Message*',
'class' => 'mb-2'
],
'required' => false
])
->add('sign', CheckboxType::class, [
'label' => 'J’accepte que mes données personnelles soient utilisées dans le cadre d’une communication avec Floor.',
'attr' => [
'class' => 'mb-2'
],
'required' => true,
'mapped' => false
])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => ContactDTO::class,
]);
}
}