src/Form/PodcastContactType.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\ContactPodcast;
  4. use Karser\Recaptcha3Bundle\Form\Recaptcha3Type;
  5. use Karser\Recaptcha3Bundle\Validator\Constraints\Recaptcha3;
  6. use Symfony\Component\Form\AbstractType;
  7. use Symfony\Component\Form\Extension\Core\Type\TextType;
  8. use Symfony\Component\Form\FormBuilderInterface;
  9. use Symfony\Component\OptionsResolver\OptionsResolver;
  10. class PodcastContactType extends AbstractType
  11. {
  12.     public function buildForm(FormBuilderInterface $builder, array $options): void
  13.     {
  14.         $builder
  15.             ->add('email'TextType::class, [
  16.                 'attr' => [
  17.                     'placeholder' => 'E-mail'
  18.                 ]
  19.             ])
  20.             ->add('siteInternet'TextType::class, [
  21.                 'attr' => [
  22.                     'placeholder' => 'Site internet (Exemple : monsite.fr)'
  23.                 ]
  24.             ])
  25.             ->add('captcha'Recaptcha3Type::class, [
  26.                 'constraints' => new Recaptcha3(),
  27.                 'action_name' => 'PodcastContactType',
  28.                 //'script_nonce_csp' => $nonceCSP,
  29.                 'locale' => 'fr',
  30.             ]);
  31.     }
  32.     public function configureOptions(OptionsResolver $resolver): void
  33.     {
  34.         $resolver->setDefaults([
  35.             'data_class' => ContactPodcast::class,
  36.         ]);
  37.     }
  38. }