public function HCaptcha::getWidget in hCaptcha 8
Build the hCaptcha captcha form.
Return value
mixed
File
- src/
HCaptcha/ HCaptcha.php, line 42
Class
Namespace
Drupal\hcaptcha\HCaptchaCode
public function getWidget($validation_function) {
// Captcha requires TRUE to be returned in solution.
$widget['solution'] = true;
$widget['captcha_validate'] = $validation_function;
$widget['form']['captcha_response'] = array(
'#type' => 'hidden',
'#value' => 'hCaptcha no captcha',
);
// As the validate callback does not depend on sid or solution, this
// captcha type can be displayed on cached pages.
$widget['cacheable'] = true;
$widget['form']['hcaptcha_widget'] = array(
'#markup' => '<div' . $this
->getAttributesString() . '></div>',
);
return $widget;
}