diff --git a/config/services.xml b/config/services.xml index ae280fa..ce3c41c 100644 --- a/config/services.xml +++ b/config/services.xml @@ -5,10 +5,9 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - %beelab_recaptcha2.secret% - + diff --git a/src/BeelabRecaptcha2Bundle.php b/src/BeelabRecaptcha2Bundle.php index aa7fb08..6bdfbae 100644 --- a/src/BeelabRecaptcha2Bundle.php +++ b/src/BeelabRecaptcha2Bundle.php @@ -2,6 +2,7 @@ namespace Beelab\Recaptcha2Bundle; +use Beelab\Recaptcha2Bundle\DependencyInjection\Compiler\RequestMethodPass; use Beelab\Recaptcha2Bundle\DependencyInjection\Compiler\TwigFormPass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; @@ -12,6 +13,7 @@ public function build(ContainerBuilder $container): void { parent::build($container); $container->addCompilerPass(new TwigFormPass()); + $container->addCompilerPass(new RequestMethodPass()); } public function getPath(): string diff --git a/src/DependencyInjection/Compiler/RequestMethodPass.php b/src/DependencyInjection/Compiler/RequestMethodPass.php new file mode 100644 index 0000000..4c1e912 --- /dev/null +++ b/src/DependencyInjection/Compiler/RequestMethodPass.php @@ -0,0 +1,17 @@ +getDefinition('beelab_recaptcha2.google_recaptcha'); + $methodClass = $container->getParameter('beelab_recaptcha2.request_method'); + $methodService = $container->getDefinition($methodClass); + $service->replaceArgument(1, $methodService); + } +}