CMS  Version 3.9
RecaptchaV2FieldRenderer Class Reference

Inherits FieldRenderer.

Public Member Functions

 __construct (&$form)
 
 renderScript ($field)
 
 renderField ($field="")
 

Detailed Description

Definition at line 95 of file recaptcha_v2_field_renderer.inc.

Constructor & Destructor Documentation

◆ __construct()

RecaptchaV2FieldRenderer::__construct ( $form)

Definition at line 97 of file recaptcha_v2_field_renderer.inc.

98  {
99  parent::__construct($form);
100 
101  $this->field = "captcha";
102  $form->add($this);
103 
104  $site_key = Settings::getValue("captcha", "recaptcha_site_key");
105  $secret_key = Settings::getValue("captcha", "recaptcha_secret_key");
106 
107  if(!$site_key || !$secret_key)
108  {
109  throw new FakoliException("reCAPTCHA v2 keys must be provided in CMS Application Settings.");
110  }
111 
112  $this->hideLabel = true;
113  $this->colspan = 2;
114  $form->validator->add(new RecaptchaV2Validator());
115  }
$form
FakoliException is the base exception class for all Fakoli errors.
Definition: core.inc:53
static getValue($component, $name)
Retrieve the value of the specified Setting.
Definition: settings.inc:104
$topicList colspan
Definition: group_form.inc:54
$openData field
$typeSelect hideLabel

Member Function Documentation

◆ renderField()

RecaptchaV2FieldRenderer::renderField (   $field = "")

Definition at line 124 of file recaptcha_v2_field_renderer.inc.

125  {
126  $site_key = Settings::getValue("captcha", "recaptcha_site_key");
127 
128  if (!$field) $field = $this->field;
129 
130  $this->_startField($field);
131 ?>
132  <div class='captcha_wrapper'>
133  <div class="g-recaptcha" data-sitekey="<?echo $site_key?>"></div>
134  </div>
135 <?
136  $this->_endField($field);
137  }

◆ renderScript()

RecaptchaV2FieldRenderer::renderScript (   $field)

Definition at line 117 of file recaptcha_v2_field_renderer.inc.

118  {
119 ?>
120  <script src='https://www.google.com/recaptcha/api.js'></script>
121 <?
122  }

The documentation for this class was generated from the following file: