You are here

function lingotek_comment_delete in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.3 lingotek.module \lingotek_comment_delete()

Implements hook_comment_delete().

File

./lingotek.module, line 1631

Code

function lingotek_comment_delete($comment) {
  $target_types = variable_get('lingotek_translate_comments_node_types', array());
  $comment_node = lingotek_node_load_default($comment->nid);
  $valid_translation_target = !empty($comment_node->type) && isset($target_types[$comment_node->type]);
  if (class_exists('LingotekComment') && variable_get('lingotek_translate_comments', FALSE) && $valid_translation_target) {
    $lingotek_comment = LingotekComment::load($comment);
    $doc_id = $lingotek_comment
      ->getMetadataValue('document_id');
    if (is_numeric($doc_id)) {
      $api = LingotekApi::instance();
      $api
        ->removeDocument($doc_id, FALSE);
    }
  }
}