public function Captcha::getInfo in CAPTCHA 8
Returns the element properties for this element.
Return value
array An array of element properties. See \Drupal\Core\Render\ElementInfoManagerInterface::getInfo() for documentation of the standard properties of all elements, and the return value format.
Overrides ElementInterface::getInfo
File
- src/
Element/ Captcha.php, line 58
Class
- Captcha
- Defines the CAPTCHA form element with default properties.
Namespace
Drupal\captcha\ElementCode
public function getInfo() {
$captcha_element = [
'#input' => TRUE,
'#process' => [
[
static::class,
'processCaptchaElement',
],
],
// The type of challenge: e.g. 'default', 'captcha/Math', etc.
'#captcha_type' => 'default',
'#default_value' => '',
// CAPTCHA in admin mode: presolve the CAPTCHA and always show
// it (despite previous successful responses).
'#captcha_admin_mode' => FALSE,
// The default CAPTCHA validation function.
// TODO: should this be a single string or an array of strings?
'#captcha_validate' => 'captcha_validate_strict_equality',
];
// Override the default CAPTCHA validation function for case
// insensitive validation.
// TODO: shouldn't this be done somewhere else, e.g. in form_alter?
if (CAPTCHA_DEFAULT_VALIDATION_CASE_INSENSITIVE == $this->configFactory
->get('captcha.settings')
->get('default_validation')) {
$captcha_element['#captcha_validate'] = 'captcha_validate_case_insensitive_equality';
}
return $captcha_element;
}