From 0364e21476326d86d96c11bccb72ebb1d1c1a07e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Tue, 14 Oct 2025 12:43:15 +0200 Subject: [PATCH] Allow captcha to be enabled in form service definition --- Form/CaptchaType.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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'); -- 2.41.3