File tree Expand file tree Collapse file tree 1 file changed +3
-19
lines changed
Expand file tree Collapse file tree 1 file changed +3
-19
lines changed Original file line number Diff line number Diff line change 1111/**
1212 * Provides reCAPTCHA support to Twig views
1313 */
14- class ReCaptchaExtension extends \Twig_Extension
14+ class ReCaptchaExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface
1515{
1616 /**
1717 * reCAPTCHA site key
@@ -34,30 +34,14 @@ public function getName() {
3434 return 'reCAPTCHA ' ;
3535 }
3636
37- /**
38- * Generates and returns the HTML code necessary for reCAPTCHA on a form
39- * @return string The HTML needed for a reCAPTCHA form element
40- */
41- public function reCaptchaForm () {
42- return "<div class= \"g-recaptcha \" data-sitekey= " . $ this ->siteKey . "></div> " ;
43- }
44-
45- /**
46- * Returns the script necessary for
47- * @return string The HTML script tag needed for reCAPTCHA to function
48- */
49- public function reCaptchaScript () {
50- return '<script src="https://www.google.com/recaptcha/api.js" async defer></script> ' ;
51- }
52-
5337 /**
5438 * {@inheritdoc}
5539 */
5640 public function getGlobals () {
5741 return [
5842 'recaptcha ' => [
59- 'script ' => $ this -> reCaptchaScript () ,
60- 'form ' => $ this ->reCaptchaForm () ,
43+ 'script ' => ' <script src="https://www.google.com/recaptcha/api.js" async defer></script> ' ,
44+ 'form ' => ' <div class="g-recaptcha" data-sitekey=" ' . $ this ->siteKey . ' "></div> ' ,
6145 ],
6246 ];
6347 }
You can’t perform that action at this time.
0 commit comments