language_fallback_get_candidates

7 language.inc language_fallback_get_candidates($type = LANGUAGE_TYPE_CONTENT)
8 language.inc 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.

1 call to language_fallback_get_candidates()

File

includes/language.inc, line 451
Multiple language handling functionality.

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;
}
Login or register to post comments