function recaptcha_v3_token_element in reCAPTCHA v3 7
Form element for recaptcha v3.
Parameters
$action_id:
Return value
array
1 call to recaptcha_v3_token_element()
- recaptcha_v3_captcha in ./
recaptcha_v3.module - Implements hook_captcha().
File
- ./
recaptcha_v3.module, line 254 - Verifies if user is a human without necessity to solve a CAPTCHA.
Code
function recaptcha_v3_token_element($action_id) {
$action = _recaptcha_v3_get_action_by_id($action_id);
return array(
'#type' => 'hidden',
'#default_value' => '',
'#attributes' => array(
'data-recaptcha-v3-action' => $action['action'],
'data-recaptcha-v3-sitekey' => variable_get('recaptcha_v3_site_key', ''),
),
'#attached' => array(
'js' => array(
array(
'type' => 'file',
'data' => drupal_get_path('module', 'recaptcha_v3') . '/js/recaptcha_v3.js',
'scope' => 'footer',
),
array(
'type' => 'external',
'data' => url('https://www.google.com/recaptcha/api.js', array(
'query' => array(
'render' => variable_get('recaptcha_v3_site_key', ''),
),
'absolute' => TRUE,
)),
'scope' => 'header',
'group' => JS_LIBRARY,
),
),
),
);
}