You are here

function lingotek_comment_delete in Lingotek Translation 7.3

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

Implements hook_comment_delete().

File

./lingotek.module, line 1187

Code

function lingotek_comment_delete($comment) {
  $target_types = variable_get('lingotek_translate_comments_node_types', array());
  $comment_node = node_load($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);
    }
  }
}