You are here

public function LingotekAccount::getManagedTargets in Lingotek Translation 7.2

1 call to LingotekAccount::getManagedTargets()
LingotekAccount::getManagedTargetsAsJSON in lib/Drupal/lingotek/LingotekAccount.php

File

lib/Drupal/lingotek/LingotekAccount.php, line 91
Defines LingotekAccount.

Class

LingotekAccount
A class representing a Lingotek Account

Code

public function getManagedTargets($as_detailed_objects = FALSE, $return_lingotek_codes = TRUE) {
  lingotek_add_missing_locales();

  // fills in any missing lingotek_locale values to the languages table
  $targets_drupal = language_list();
  $default_language = language_default();
  $targets = array();
  foreach ($targets_drupal as $key => $target) {
    $is_source = $default_language->language == $target->language;
    $is_lingotek_managed = $this
      ->isEnterprise() === TRUE || $target->lingotek_enabled;

    //in_array($target->language, $lingotek_managed_targets);
    if ($is_source) {
      continue;

      // skip, since the source language is not a target
    }
    else {
      if (!$is_lingotek_managed) {
        continue;

        // skip, since lingotek is not managing the language
      }
    }
    $target->active = $target->lingotek_enabled;
    $targets[$key] = $target;
  }
  return $as_detailed_objects ? $targets : array_map(function ($obj) {
    return $obj->lingotek_locale;
  }, $targets);
}