<?php
namespace App\Form;
use App\Entity\Demandeformations;
use Symfony\Component\Form\AbstractType;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\File;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\UrlType;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Karser\Recaptcha3Bundle\Form\Recaptcha3Type;
use Karser\Recaptcha3Bundle\Validator\Constraints\Recaptcha3;
class DemandeformationFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('civilite', ChoiceType::class, [
'mapped' => false,
'attr' => [
'class' => 'form-control',
],
'choices' => [
// 'choix du rôle de l\'utilisateur' => 'choix',
'M.' => 'Monsieur',
'Mme' => 'Madame',
'Mlle' => 'Mademoiselle',
],
'label' => 'Civilité <span style="color:red">*</span>',
'label_html' => true,])
->add('theme', TextType::class, [
'required' => true,
'attr' => [
'class' => 'form-control',
],
'label' => 'Thème de la formation souhaité <span style="color:red">*</span>',
'label_html' => true,])
->add('lieu', TextType::class, [
'required' => true,
'attr' => [
'class' => 'form-control mt-1 mb-1',
'minlenght' => '2',
'maxlenght' => '100'
],
'label' => 'Lieu de la formation souhaité <span style="color:red">*</span>',
'label_html' => true,])
->add('duree', TextType::class, [
'required' => true,
'attr' => [
'class' => 'form-control mt-1 mb-1',
'minlenght' => '2',
'maxlenght' => '100'
],
'label' => 'Date de la formation souhaitée <span style="color:red">*</span>',
'label_html' => true,])
->add('nombrepart', TextType::class, [
'required' => true,
'attr' => [
'class' => 'form-control mt-1 mb-1',
'minlenght' => '2',
'maxlenght' => '100'
],
'label' => 'Nombre de participants <span style="color:red">*</span>',
'label_html' => true,])
->add('fonction', TextType::class, [
'required' => true,
'attr' => [
'class' => 'form-control mt-1 mb-1',
],
'label' => 'Fonction <span style="color:red">*</span>',
'label_html' => true,])
->add('nom', TextType::class, [
'required' => true,
'attr' => [
'class' => 'form-control mt-1 mb-1',
],
'label' => 'Nom <span style="color:red">*</span>',
'label_html' => true,])
->add('prenoms', TextType::class, [
'required' => true,
'attr' => [
'class' => 'form-control mt-1 mb-1',
],
'label' => 'Prénoms <span style="color:red">*</span>',
'label_html' => true,])
->add('mail', EmailType::class, [
'required' => true,
'attr' => [
'class' => 'form-control mt-1 mb-1',
'minlenght' => '2',
'maxlenght' => '100'
],
'label' => 'Adresse email <span style="color:red">*</span>',
'label_html' => true,])
->add('entreprise', TextType::class, [
'required' => true,
'attr' => [
'class' => 'form-control mt-1 mb-1',
],
'label' => 'Entreprise <span style="color:red">*</span>',
'label_html' => true,])
->add('siteweb', UrlType::class, [
'required' => true,
'attr' => [
'class' => 'form-control mt-1 mb-1',
],
'label' => "Site Web de votre Entreprise"])
->add('telephone', TextType::class, [
'required' => true,
'attr' => [
'class' => 'form-control mt-1 mb-1',
],
'label' => 'Numéro de téléphone <span style="color:red">*</span>',
'label_html' => true,])
->add('adresse', TextType::class, [
'required' => true,
'attr' => [
'class' => 'form-control mt-1 mb-1',
],
'label' => "Adresse",
'label_html' => true,])
->add('commentaire', TextareaType::class, [
'required' => true,
'attr' => [
'class' => 'form-control textarea',
],
'label' => "Commentaire"])
->add('captcha', Recaptcha3Type::class, [
'constraints' => new Recaptcha3(),
'action_name' => 'contact',
'constraints' => new Recaptcha3 ([
'message' => 'karser_recaptcha3.message',
'messageMissingValue' => 'karser_recaptcha3.message_missing_value',
]),
])
->add('submit', SubmitType::class, [
'attr' => [
'class' => 'btn btn-primary btn-large',
'style' =>'margin-top: 20px;'
],
'label' => 'Demander un dévis']);
// ...
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Demandeformations::class,
]);
}
}