public function getManagedTargets($as_detailed_objects = FALSE)
 {
     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 = $target->lingotek_enabled;
         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;
     }
     $result = $as_detailed_objects ? $targets : array_map(create_function('$obj', 'return $obj->lingotek_locale;'), $targets);
     return $result;
 }
Esempio n. 2
0
 /**
  * Gets the site's available target languages for Lingotek translation.
  *
  * @param $pluck_field - mixed
  *   NULL - return the entire object
  *   string - return an array of just the pluck_field specified (if it exists)
  *   array - return an array of the selected fields   
  * 
  * @return array
  *   An array of Lingotek language codes.
  */
 public static function getLanguages($pluck_field = NULL, $include_disabled = FALSE, $lingotek_locale_to_exclude = NULL)
 {
     lingotek_add_missing_locales(FALSE);
     $languages = array();
     foreach (language_list() as $target_language) {
         if ($target_language->lingotek_locale == $lingotek_locale_to_exclude) {
             continue;
         }
         $language = is_string($pluck_field) && isset($target_language->{$pluck_field}) ? $target_language->{$pluck_field} : $target_language;
         if ($target_language->lingotek_enabled) {
             // include all languages enabled
             $languages[$target_language->lingotek_locale] = $language;
         } else {
             if ($include_disabled) {
                 // include all languages, including disabled (lingotek_enabled is 0)
                 $languages[$target_language->lingotek_locale] = $language;
             }
         }
     }
     return $languages;
 }