From: Raphaƫl Gertz <git@rapsys.eu>
Date: Sun, 8 Dec 2024 04:50:06 +0000 (+0100)
Subject: Set bundle alias as translation domain for captcha inherited forms
X-Git-Tag: 0.5.4~18
X-Git-Url: https://git.rapsys.eu/packbundle/commitdiff_plain/013e3b68170a39d007a29ef45ea0eb222fbcb2d8

Set bundle alias as translation domain for captcha inherited forms
---

diff --git a/Form/CaptchaType.php b/Form/CaptchaType.php
index c3a5f69..015a91b 100644
--- a/Form/CaptchaType.php
+++ b/Form/CaptchaType.php
@@ -11,6 +11,7 @@
 
 namespace Rapsys\PackBundle\Form;
 
+use Rapsys\PackBundle\RapsysPackBundle;
 use Rapsys\PackBundle\Util\ImageUtil;
 use Rapsys\PackBundle\Util\SluggerUtil;
 
@@ -49,7 +50,7 @@ class CaptchaType extends AbstractType {
 		//With image, slugger and translator
 		if (!empty($options['captcha']) && $this->image !== null && $this->slugger !== null && $this->translator !== null) {
 			//Set captcha
-			$captcha = $this->image->getCaptcha((new \DateTime('-1 year'))->getTimestamp());
+			$captcha = $this->image->getCaptcha();
 
 			//Add captcha token
 			$builder->add('_captcha_token', HiddenType::class, ['data' => $captcha['token'], 'empty_data' => $captcha['token'], 'mapped' => false]);
@@ -70,7 +71,7 @@ class CaptchaType extends AbstractType {
 		parent::configureOptions($resolver);
 
 		//Set defaults
-		$resolver->setDefaults(['captcha' => false]);
+		$resolver->setDefaults(['captcha' => false, 'translation_domain' => RapsysPackBundle::getAlias()]);
 
 		//Add extra captcha option
 		$resolver->setAllowedTypes('captcha', 'boolean');