/** * Determine if Mollom validation should be run. * * This is required because even with limit_validation_errors set, Drupal * will still run the form validation (and then just not display the errors). * We don't want to contact Mollom to validate a CAPTCHA when the request is * simply to retrieve a new one. */ protected static function shouldValidate(array $form, FormStateInterface $form_state) { // If the triggering element is within the captcha element, then no Mollom // validation should even run because it's pulling a new captcha element. return !Mollom::isCaptchaRefreshProcessing($form_state) && !Mollom::isCaptchaSwitchProcessing($form_state); }