You are here

function lost_character_captcha_form_alter in CAPTCHA Pack 8

Implements hook_form_alter().

File

text_captcha/modules/lost_character_captcha/lost_character_captcha.module, line 26
Contains general functionality of the module.

Code

function lost_character_captcha_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  if ($form_id == 'lost_character_captcha_settings') {
    $config = Drupal::config('lost_character_captcha.settings');

    // Set a warning if the numbers to lose is to big and if hinting is off.
    if ($config
      ->get('lost_character_captcha_quantity') > 2 && !$config
      ->get('lost_character_captcha_enable_hint')) {
      drupal_set_message(t('Losing more than two characters without indication where they are lost could be too hard for a human. Check your settings.'), 'warning');
    }
  }
}