From: Raphaƫl Gertz Date: Tue, 14 Oct 2025 10:43:15 +0000 (+0200) Subject: Allow captcha to be enabled in form service definition X-Git-Tag: 0.5.6~2 X-Git-Url: https://git.rapsys.eu/packbundle/commitdiff_plain/0364e21476326d86d96c11bccb72ebb1d1c1a07e?ds=sidebyside Allow captcha to be enabled in form service definition --- diff --git a/Form/CaptchaType.php b/Form/CaptchaType.php index f8cf3d0..8b0a872 100644 --- a/Form/CaptchaType.php +++ b/Form/CaptchaType.php @@ -37,8 +37,9 @@ class CaptchaType extends AbstractType { * @param ?ImageUtil $image The image instance * @param ?SluggerUtil $slugger The slugger instance * @param ?TranslatorInterface $translator The translator instance + * @param bool $enable Use captcha */ - public function __construct(protected ?ImageUtil $image = null, protected ?SluggerUtil $slugger = null, protected ?TranslatorInterface $translator = null) { + public function __construct(protected ?ImageUtil $image = null, protected ?SluggerUtil $slugger = null, protected ?TranslatorInterface $translator = null, protected bool $enable = false) { } /** @@ -71,7 +72,7 @@ class CaptchaType extends AbstractType { parent::configureOptions($resolver); //Set defaults - $resolver->setDefaults(['captcha' => false, 'error_bubbling' => true, 'translation_domain' => RapsysPackBundle::getAlias()]); + $resolver->setDefaults(['captcha' => $this->enable, 'error_bubbling' => true, 'translation_domain' => RapsysPackBundle::getAlias()]); //Add extra captcha option $resolver->setAllowedTypes('captcha', 'boolean');