<?php
namespace App\Form;
use App\Entity\Abonne;
use Symfony\Component\Form\AbstractType;
use Gregwar\CaptchaBundle\Type\CaptchaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
class AbonneType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('email', EmailType::class, [
'label' => false,
'attr' => [
'class' => 'form-control mb-3',
'style' => 'font-size: 0.9rem;',
'placeholder' => 'Veuillez saisir votre adresse e-mail'
]
])
->add('captcha', CaptchaType::class, [
'label' => false,
'as_url' => true,
'reload' => true,
'length' => 6,
'attr' => [
'style' => 'width: 175px',
'class' => 'form-control mb-4',
]
])
->add('submit', SubmitType::class, [
'label' => 'S\'inscrire à la Newsletter',
'attr' => [
'class' => 'btn btn-sm btn-primary'
]
])
// ->add('isEnabled')
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Abonne::class,
]);
}
}