File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -35,13 +35,16 @@ class ReCaptcha extends JavaScript
3535 /** @var string */
3636 protected $ renderType ;
3737
38+ /** @var string */
39+ protected $ theme ;
40+
3841 /**
3942 * {@inheritdoc}
4043 */
4144 public function __toString ()
4245 {
4346 $ onLoad = ($ this ->getRenderType () == 'invisible ' ) ? '&render=explicit&onload=invisibleRecaptchaOnLoad ' : '' ;
44- $ theme = sprintf ('<script>var RecaptchaOptions = { theme : "" };</script> ' , ' clean ' );
47+ $ theme = sprintf ('<script>var RecaptchaOptions = { theme : "%s " };</script> ' , $ this -> getTheme () );
4548 $ api = sprintf ('<script src="https://www.google.com/recaptcha/api.js?hl=%s%s" async defer></script> ' , $ this ->getHtmlLang (), $ onLoad );
4649
4750 return $ theme . $ api ;
@@ -86,4 +89,23 @@ public function setRenderType($type)
8689
8790 return $ this ;
8891 }
92+
93+ /**
94+ * @return string
95+ */
96+ public function getTheme ()
97+ {
98+ return $ this ->theme ;
99+ }
100+
101+ /**
102+ * @param string $theme
103+ * @return ReCaptcha
104+ */
105+ public function setTheme ($ theme )
106+ {
107+ $ this ->theme = $ theme ;
108+
109+ return $ this ;
110+ }
89111}
Original file line number Diff line number Diff line change @@ -276,6 +276,7 @@ private function queueReCaptcha()
276276 $ reCaptcha
277277 ->setHtmlLang ($ this ->app ['locale ' ])
278278 ->setRenderType ($ this ->config ->getReCaptcha ()->get ('type ' ))
279+ ->setTheme ($ this ->config ->getReCaptcha ()->get ('theme ' ))
279280 ->setLocation (Target::END_OF_BODY )
280281 ->setZone (Zone::FRONTEND )
281282 ;
You can’t perform that action at this time.
0 commit comments