language_fallback_get_candidates
- Versions
- 7
language_fallback_get_candidates($type = LANGUAGE_TYPE_CONTENT)
Return the possible fallback languages ordered by language weight.
Parameters
The language type.
Return value
An array of language codes.
Code
includes/language.inc, line 367
<?php
function language_fallback_get_candidates($type = LANGUAGE_TYPE_CONTENT) {
$fallback_candidates = &drupal_static(__FUNCTION__);
if (!isset($fallback_candidates)) {
$fallback_candidates = array();
// Get languages ordered by weight.
// Use array keys to avoid duplicated entries.
foreach (language_list('weight') as $languages) {
foreach ($languages as $language) {
$fallback_candidates[$language->language] = NULL;
}
}
$fallback_candidates = array_keys($fallback_candidates);
$fallback_candidates[] = LANGUAGE_NONE;
// Let other modules hook in and add/change candidates.
drupal_alter('language_fallback_candidates', $fallback_candidates);
}
return $fallback_candidates;
}
?>Login or register to post comments 