On this page
function language_fallback_get_candidates
language_fallback_get_candidates($type = LANGUAGE_TYPE_CONTENT)
Returns the possible fallback languages ordered by language weight.
Parameters
(optional) The language type. Defaults to LANGUAGE_TYPE_CONTENT.:
Return value
An array of language codes.
Related topics
File
- includes/language.inc, line 554
- Language Negotiation API.
Code
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;
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!language.inc/function/language_fallback_get_candidates/7.x