function _entity_translation_language_fallback_get_candidates in Entity Translation 7
Returns language fallback candidates for a certain language.
Parameters
object $language: Drupal language object.
Return value
array An array of language codes in the fallback order.
1 call to _entity_translation_language_fallback_get_candidates()
- entity_translation_overview in ./
entity_translation.admin.inc - Translations overview page callback.
File
- ./
entity_translation.admin.inc, line 781 - The entity translation user interface.
Code
function _entity_translation_language_fallback_get_candidates($language) {
// Save original fallback candidates.
$language_fallback_original = drupal_static('language_fallback_get_candidates');
// Replace all global languages with the given one. We need this because the
// language_fallback_get_candidates() does not take the $language parameter,
// however other modules (like language_fallback) may use current language(s)
// when they alter the language fallback candidates.
$languages_original = array();
foreach (language_types() as $language_type) {
$languages_original[$language_type] = $GLOBALS[$language_type];
$GLOBALS[$language_type] = $language;
}
// Clear static cache, so that fallback candidates are recalculated.
drupal_static_reset('language_fallback_get_candidates');
$language_fallback_candidates = language_fallback_get_candidates();
// Restore original data.
$language_fallback =& drupal_static('language_fallback_get_candidates');
$language_fallback = $language_fallback_original;
foreach ($languages_original as $language_type => $_language) {
$GLOBALS[$language_type] = $_language;
}
return $language_fallback_candidates;
}