You are here

function _honeypot_log in Honeypot 8

Same name and namespace in other branches
  1. 6 honeypot.module \_honeypot_log()
  2. 7 honeypot.module \_honeypot_log()
  3. 2.0.x honeypot.module \_honeypot_log()

Log blocked form submissions.

Parameters

string $form_id: Form ID for the form on which submission was blocked.

string $type: String indicating the reason the submission was blocked. Allowed values:

  • honeypot: If honeypot field was filled in.
  • honeypot_time: If form was completed before the configured time limit.
2 calls to _honeypot_log()
_honeypot_honeypot_validate in ./honeypot.module
Validate honeypot field.
_honeypot_time_restriction_validate in ./honeypot.module
Validate honeypot's time restriction field.

File

./honeypot.module, line 258
Honeypot module, for deterring spam bots from completing Drupal forms.

Code

function _honeypot_log($form_id, $type) {
  honeypot_log_failure($form_id, $type);
  if (\Drupal::config('honeypot.settings')
    ->get('log')) {
    $variables = [
      '%form' => $form_id,
      '@cause' => $type == 'honeypot' ? t('submission of a value in the honeypot field') : t('submission of the form in less than minimum required time'),
    ];
    \Drupal::logger('honeypot')
      ->notice(t('Blocked submission of %form due to @cause.', $variables));
  }
}