You are here

public static function LingotekSync::getAllTargetStatusForEntity in Lingotek Translation 7.7

7 calls to LingotekSync::getAllTargetStatusForEntity()
lingotek_batch_keystore_worker in ./lingotek.batch.inc
Batch worker function for lingotek_keystore operations
lingotek_delete_node_translations in ./lingotek.util.inc
Delete translations for node based entities
lingotek_entity_disassociate_form_submit in ./lingotek.bulk_grid.inc
Submit handler for the lingotek_entity_disassociate form.
lingotek_entity_save in ./lingotek.module
lingotek_grid_query_status in ./lingotek.bulk_grid.inc

... See full list

File

lib/Drupal/lingotek/LingotekSync.php, line 59
LingotekSync

Class

LingotekSync
A utility class for Lingotek Syncing.

Code

public static function getAllTargetStatusForEntity($entity_type, $entity_id, $lingotek_locale = NULL) {
  $dbkey = 'target_sync_status_';
  $query = db_select('lingotek_entity_metadata', 'l')
    ->fields('l', array(
    'entity_key',
    'value',
  ))
    ->condition('entity_type', $entity_type)
    ->condition('entity_id', $entity_id);
  if ($lingotek_locale !== NULL) {
    $query
      ->condition('entity_key', $dbkey . $lingotek_locale);
  }
  else {
    $query
      ->condition('entity_key', $dbkey . '%', 'LIKE');
  }
  $result = $query
    ->execute()
    ->fetchAll();
  $targets = array();
  foreach ($result as $r_obj) {

    // get the locale of each result
    $locale = substr($r_obj->entity_key, strlen($dbkey));

    // assign the status for that locale
    $targets[$locale] = $r_obj->value;
  }
  return $targets;
}