You are here

function lingotek_sync in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.2 lingotek.sync.inc \lingotek_sync()
  2. 7.4 lingotek.sync.inc \lingotek_sync()

The main function responsible for syncing node/document translation.

5 string references to 'lingotek_sync'
LingotekNode::loadLingonode in lib/Drupal/lingotek/LingotekNode.php
Method for loading the values for the lingonode
lingotek_admin_content_defaults_form in ./lingotek.admin.inc
Content defaults Form
lingotek_form_bulk_sync in ./lingotek.sync.inc
lingotek_form_node_form_alter in ./lingotek.module
Implements hook_form_BASE_FORM_ID_alter().
lingotek_notifications in ./lingotek.sync.inc
Registers the site translation notfication callback.

File

./lingotek.sync.inc, line 182
Sync and management

Code

function lingotek_sync() {
  $parameters = $_GET;
  $method = $_SERVER['REQUEST_METHOD'];
  $status = "200";
  $test = isset($parameters['test']) && $parameters['test'] && strcmp($parameters['test'], 'false') != 0 ? TRUE : FALSE;
  $request = array(
    'test' => $test,
    'method' => $method,
    'parameters' => $parameters,
  );
  $request['upload_nids_as_json'] = $upload_nids = isset($parameters['upload_nids']) ? json_decode($parameters['upload_nids']) : NULL;
  $request['upload_config_as_json'] = $upload_config = isset($parameters['upload_config']) ? json_decode($parameters['upload_config']) : NULL;
  $request['download_targets_as_json'] = $download_targets = isset($parameters['download_targets_as_json']) ? json_decode($parameters['download_targets_as_json']) : NULL;
  if ($test) {
    lingotek_json_output_cors($request, $status, array(
      'methods_allowed' => 'GET,POST',
    ));
  }
  else {
    lingotek_sync_batch_create($upload_nids, $upload_config, $download_targets);
  }
}