src/Form/NewsletterSubscriberType.php line 10

  1. <?php
  2. namespace App\Form;
  3. use App\Entity\NewsletterSubscriber;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\FormBuilderInterface;
  6. use Symfony\Component\OptionsResolver\OptionsResolver;
  7. class NewsletterSubscriberType extends AbstractType
  8. {
  9.     public function buildForm(FormBuilderInterface $builder, array $options): void
  10.     {
  11.         $builder
  12.             ->add('email')
  13.         ;
  14.     }
  15.     public function configureOptions(OptionsResolver $resolver): void
  16.     {
  17.         $resolver->setDefaults([
  18.             'data_class' => NewsletterSubscriber::class,
  19.             'csrf_protection' => true,
  20.             'csrf_field_name' => '_token',
  21.             'csrf_token_id' => 'newsletter-subscriber'
  22.         ]);
  23.     }
  24. }