You are here

function cleantalk_comment_presave in Anti Spam by CleanTalk 8.3

Same name and namespace in other branches
  1. 8.4 cleantalk.module \cleantalk_comment_presave()
  2. 8 cleantalk.module \cleantalk_comment_presave()
  3. 7.5 cleantalk.module \cleantalk_comment_presave()
  4. 7 cleantalk.module \cleantalk_comment_presave()
  5. 7.2 cleantalk.module \cleantalk_comment_presave()
  6. 7.4 cleantalk.module \cleantalk_comment_presave()
  7. 9.1.x cleantalk.module \cleantalk_comment_presave()

Implements hook_comment_presave().

File

./cleantalk.module, line 305

Code

function cleantalk_comment_presave(\Drupal\comment\CommentInterface $comment) {
  $ct_result = CleantalkFuncs::_cleantalk_ct_result();
  if (!empty($ct_result['ct_request_id'])) {
    if ($ct_result['ct_result_allow'] === 0 && \Drupal::config('cleantalk.settings')
      ->get('cleantalk_check_comments_automod')) {
      $comment
        ->setPublished(false);
    }
  }
}