Skip to content

Commit 06b3ca4

Browse files
committed
Forgot to make things Twig 2 compatible!
1 parent 0217b84 commit 06b3ca4

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

app/Twig/Extensions/ReCaptchaExtension.php

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
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
}

0 commit comments

Comments
 (0)