- //Add event listener on captcha
- $builder->addEventListener(FormEvents::PRE_SUBMIT, [$this, 'validateCaptcha']);
- }
+ //Add event listener on captcha
+ $builder->addEventListener(FormEvents::PRE_SUBMIT, [$this, 'validateCaptcha']);
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function configureOptions(OptionsResolver $resolver): void {
+ //Call parent configure options
+ parent::configureOptions($resolver);
+
+ //Set defaults
+ $resolver->setDefaults(['captcha' => false]);
+
+ //Add extra captcha option
+ $resolver->setAllowedTypes('captcha', 'boolean');
+ }