src/Form/AccessCodeType.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\Extension\Core\Type\TextType;
  5. use Symfony\Component\Form\FormBuilderInterface;
  6. use Symfony\Component\Validator\Constraints\NotBlank;
  7. use Karser\Recaptcha3Bundle\Form\Recaptcha3Type;
  8. use Karser\Recaptcha3Bundle\Validator\Constraints\Recaptcha3;
  9. use Symfony\Component\Validator\Constraints\EqualTo;
  10. class AccessCodeType extends AbstractType
  11. {
  12.     public function buildForm(FormBuilderInterface $builder, array $options): void
  13.     {
  14.         $builder
  15.             ->add('key'TextType::class, [
  16.                 'constraints' => [
  17.                     new NotBlank(message'Veuillez entrer votre code pour accéder aux ateliers vidéos'),
  18.                     new EqualTo('DEUILAM2022'message'Code invalide')
  19.                 ],
  20.                 'required' => true,
  21.                 'label' => false,
  22.                 'attr' => [
  23.                     'placeholder' => 'Code',
  24.                     'class' => 'form-control'
  25.                 ]
  26.             ])
  27.             ->add('captcha'Recaptcha3Type::class, [
  28.                 'constraints' => new Recaptcha3(),
  29.                 'action_name' => 'homepage'
  30.             ])
  31.         ;
  32.     }
  33. }