You are here

function lingotek_mt_sync_upload_node in Lingotek Translation 7.2

Upload Batch Worker Function: Upload Node for Translation

1 string reference to 'lingotek_mt_sync_upload_node'
lingotek_get_sync_upload_batch_elements in ./lingotek.batch.inc
Sync - Upload Batch Elements: Creates the batch elements for nodes/documents that need to be uploaded.

File

./lingotek.batch.inc, line 397

Code

function lingotek_mt_sync_upload_node($nid, &$context) {
  watchdog('ltk_upload_node', 'node: @node_id', array(
    '@node_id' => $nid,
  ), WATCHDOG_DEBUG);
  $api = LingotekApi::instance();
  $node = node_load($nid);

  // Push this node for translation.
  if ($existing_document = lingotek_lingonode($node->nid, 'document_id')) {

    // Update an existing Lingotek Document.
    $api
      ->updateContentDocument($node);
  }
  else {

    // Create a new Lingotek Document.
    $api
      ->addContentDocument($node, TRUE);
  }
  $context['results'][] = 'Upload Node: ' . $nid;
}