You are here

function lingotek_set_translation_published_state in Lingotek Translation 7.7

Sets the translation published state from the Lingotek preference

1 call to lingotek_set_translation_published_state()
lingotek_process_entity_xml in ./lingotek.remote.inc

File

./lingotek.util.inc, line 3448
Utility functions.

Code

function lingotek_set_translation_published_state($entity_id, $entity_type, $language, $source_published_setting) {
  $new_published_setting = '1';
  $entity_translation_entity_types = variable_get('entity_translation_entity_types');
  if (!in_array('node', $entity_translation_entity_types)) {
    return;
  }
  $published_preference = variable_get('lingotek_target_download_status', 'published');
  if ($published_preference === 'published') {
    $new_published_setting = '1';
  }
  elseif ($published_preference === 'unpublished') {
    $new_published_setting = '0';
  }
  elseif ($published_preference === 'same-as-source') {
    $new_published_setting = $source_published_setting;
  }
  LingotekSync::setEntityTranslationPublishedSetting($entity_id, $entity_type, $language, $new_published_setting);
  return $new_published_setting;
}