You are here

function captcha_requirements in CAPTCHA 8

Same name and namespace in other branches
  1. 5.3 captcha.module \captcha_requirements()
  2. 6.2 captcha.install \captcha_requirements()
  3. 6 captcha.module \captcha_requirements()
  4. 7 captcha.install \captcha_requirements()

Implements hook_requirements().

File

./captcha.install, line 89
Install, update and uninstall functions for the CAPTCHA module.

Code

function captcha_requirements($phase) {
  $requirements = [];
  $config = \Drupal::config('captcha.settings');
  if ($phase == 'runtime' && $config
    ->get('enable_stats')) {

    // Show the wrong response counter in the status report.
    $requirements['captcha_wrong_response_counter'] = [
      'title' => \Drupal::translation()
        ->translate('CAPTCHA'),
      'value' => \Drupal::translation()
        ->formatPlural(\Drupal::state()
        ->get('captcha.wrong_response_counter'), 'Already 1 blocked form submission', 'Already @count blocked form submissions'),
      'severity' => REQUIREMENT_INFO,
    ];
  }
  return $requirements;
}