From 32fea9a406864bbb0002c7842468a298d3417047 Mon Sep 17 00:00:00 2001 From: Max Roeleveld Date: Wed, 6 Nov 2019 11:45:00 +0100 Subject: [PATCH] FIX, Recaptcha: Apply the theme from the config, or any theme at all, really. --- src/Asset/ReCaptcha.php | 24 +++++++++++++++++++++++- src/BoltForms.php | 1 + 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/Asset/ReCaptcha.php b/src/Asset/ReCaptcha.php index 5b99559..9ae9c19 100644 --- a/src/Asset/ReCaptcha.php +++ b/src/Asset/ReCaptcha.php @@ -35,13 +35,16 @@ class ReCaptcha extends JavaScript /** @var string */ protected $renderType; + /** @var string */ + protected $theme; + /** * {@inheritdoc} */ public function __toString() { $onLoad = ($this->getRenderType() == 'invisible') ? '&render=explicit&onload=invisibleRecaptchaOnLoad' : ''; - $theme = sprintf('', 'clean'); + $theme = sprintf('', $this->getTheme()); $api = sprintf('', $this->getHtmlLang(), $onLoad); return $theme . $api; @@ -86,4 +89,23 @@ public function setRenderType($type) return $this; } + + /** + * @return string + */ + public function getTheme() + { + return $this->theme; + } + + /** + * @param string $theme + * @return ReCaptcha + */ + public function setTheme($theme) + { + $this->theme = $theme; + + return $this; + } } diff --git a/src/BoltForms.php b/src/BoltForms.php index e17b895..2916dcf 100644 --- a/src/BoltForms.php +++ b/src/BoltForms.php @@ -276,6 +276,7 @@ private function queueReCaptcha() $reCaptcha ->setHtmlLang($this->app['locale']) ->setRenderType($this->config->getReCaptcha()->get('type')) + ->setTheme($this->config->getReCaptcha()->get('theme')) ->setLocation(Target::END_OF_BODY) ->setZone(Zone::FRONTEND) ;