You are here

function hook_simple_recaptcha_bypass_alter in Simple Google reCAPTCHA 8

Alter reCAPTCHA access check before building final form elements.

Modules may implement this hook to add extra checks before reCAPTCHA validation is attached to the form. Changing $result param to FALSE will leave the form without reCAPTCHA protection.

Parameters

mixed $form: Form API array containing form which is about to be protected.

bool $result: Boolean indicating if reCAPTCHA validation can be skipped.

2 invocations of hook_simple_recaptcha_bypass_alter()
SimpleReCaptchaFormManager::addReCaptchaCheckbox in src/SimpleReCaptchaFormManager.php
Add reCaptcha v2 container and libraries to the form.
SimpleReCaptchaFormManager::addReCaptchaInvisible in src/SimpleReCaptchaFormManager.php
Add reCaptcha v3 container and libraries to the form.

File

./simple_recaptcha.api.php, line 26
Hooks provided by the Simple Google reCAPTCHA module.

Code

function hook_simple_recaptcha_bypass_alter(&$form, &$result) {
  if (\Drupal::currentUser()
    ->hasPermission('administer content')) {
    $result = TRUE;
  }
}