public static function Lingotek::availableLanguageTargets in Lingotek Translation 7.4
Same name and namespace in other branches
- 7.2 lib/Drupal/lingotek/Lingotek.php \Lingotek::availableLanguageTargets()
- 7.3 lib/Drupal/lingotek/Lingotek.php \Lingotek::availableLanguageTargets()
Gets the site's available target languages for Lingotek translation.
Parameters
$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 value
array An array of Lingotek language codes.
7 calls to Lingotek::availableLanguageTargets()
- Lingotek::availableLanguageTargetsWithoutSource in lib/
Drupal/ lingotek/ Lingotek.php - Lingotek::availableLanguageTargetsWithoutSourceAsJSON in lib/
Drupal/ lingotek/ Lingotek.php - LingotekApi::getConfigChunkCreateWithTargetsParams in lib/
Drupal/ lingotek/ LingotekApi.php - Gets the config-chunk-specific parameters for use in a createContentDocumentWithTargets API call.
- LingotekSync::setNodeAndTargetsStatus in lib/
Drupal/ lingotek/ LingotekSync.php - lingotek_form_bulk_sync in ./
lingotek.sync.inc
File
- lib/
Drupal/ lingotek/ Lingotek.php, line 365 - Defines Lingotek.
Class
- Lingotek
- A utility class for Lingotek translation.
Code
public static function availableLanguageTargets($pluck_field = NULL, $include_disabled = FALSE, $lingotek_locale_to_exclude = NULL) {
lingotek_add_missing_locales();
$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;
}