You are here

function lingotek_entity_upload_triggered in Lingotek Translation 7.5

Same name and namespace in other branches
  1. 7.7 lingotek.module \lingotek_entity_upload_triggered()
  2. 7.6 lingotek.module \lingotek_entity_upload_triggered()
1 call to lingotek_entity_upload_triggered()
lingotek_entity_save in ./lingotek.module

File

./lingotek.module, line 1399

Code

function lingotek_entity_upload_triggered($entity, $entity_type, $changed = TRUE, &$context = array()) {
  list($id, $vid, $bundle) = lingotek_entity_extract_ids($entity_type, $entity);
  if (isset($entity->lingotek_upload_override)) {
    if ($entity->lingotek_upload_override) {
      lingotek_entity_upload($entity, $entity_type);
    }
    return;
  }
  if (!lingotek_enabled_bundle($entity_type, $bundle) && $entity->lingotek['profile'] == LingotekSync::PROFILE_DISABLED || !isset($entity->language) || !Lingotek::isSupportedLanguage($entity->language)) {
    return;
  }
  if (isset($entity->lingotek['node_sync_status']) && $entity->lingotek['node_sync_status'] == LingotekSync::STATUS_TARGET) {
    return;
  }
  if ($entity_type == 'node' && !empty($entity->tnid) && $entity->nid != $entity->tnid) {

    //check to make sure it is not a target node
    return;
  }
  if (!$changed && $entity->lingotek['node_sync_status'] == 'CURRENT') {
    return;

    //entity has no changes.
  }
  lingotek_keystore($entity_type, $id, 'node_sync_status', LingotekSync::STATUS_EDITED);
  if ($entity->lingotek['create_lingotek_document']) {
    lingotek_entity_upload($entity, $entity_type, $context);
  }
}