You are here

function lingotek_advanced_parsing_update_node in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.2 lingotek.module \lingotek_advanced_parsing_update_node()
  2. 7.3 lingotek.module \lingotek_advanced_parsing_update_node()
  3. 7.4 lingotek.module \lingotek_advanced_parsing_update_node()
  4. 7.5 lingotek.module \lingotek_advanced_parsing_update_node()
  5. 7.6 lingotek.module \lingotek_advanced_parsing_update_node()

Processing callback for the advanced parsing update batch operation.

1 string reference to 'lingotek_advanced_parsing_update_node'
lingotek_handle_advanced_xml_upgrade in ./lingotek.admin.inc
Custom form handler for upgrading a site from using Lingotek's simple to advanced XML parsing of content.

File

./lingotek.module, line 2026

Code

function lingotek_advanced_parsing_update_node($nid, &$context) {
  $process_node = lingotek_node_load_default($nid);
  $entity_type = isset($process_node) && isset($process_node->type) ? $process_node->type : NULL;
  if (!empty($process_node->nid)) {
    $context['message'] = t('Sending advanced parsing data to Lingotek for node @node_id: @node_title', array(
      '@node_id' => $process_node->nid,
      '@node_title' => $process_node->title,
    ));
    if (LingotekApi::instance()
      ->updateContentDocument(LingotekEntity::load($process_node, $entity_type))) {
      $context['results'][] = t('Updated node: @id', array(
        '@id' => $process_node->nid,
      ));
    }
    else {
      LingotekLog::error('lingotek', 'Unable to send advanced XML version of node to Lingotek: @node_id', array(
        '@node_id' => $process_node->nid,
      ));
    }
  }
}