<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Validator\Constraints\NotBlank;
class ContactType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('nom', TextType::class, [
'required' => true,
'constraints' => new NotBlank(),
])
->add('email', TextType::class, [
'required' => true,
])
->add('message', TextareaType::class, [
'required' => true,
'attr' => ['rows' => '8'],
])
->add('captcha', TextType::class, [
'required' => true,
'constraints' => new NotBlank(),
])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
// Configure your form options here
]);
}
}