1 language.inc language_fallback_get_candidates($type = LANGUAGE_TYPE_CONTENT)

Returns the possible fallback languages ordered by language weight.

Parameters

$type: (optional) The language type. Defaults to LANGUAGE_TYPE_CONTENT.

Return value

The identifier of the first language negotiation method for the given: language type, or the default method if none exists.

Related topics

File

core/includes/language.inc, line 505
Language Negotiation API.

Code

function language_fallback_get_candidates($type = LANGUAGE_TYPE_CONTENT) {
  $fallback_candidates = &backdrop_static(__FUNCTION__);

  if (!isset($fallback_candidates)) {
    // Get languages ordered by weight, add LANGUAGE_NONE as the last one.
    $fallback_candidates = array_keys(language_list());
    $fallback_candidates[] = LANGUAGE_NONE;

    // Let other modules hook in and add/change candidates.
    backdrop_alter('language_fallback_candidates', $fallback_candidates);
  }

  return $fallback_candidates;
}