function language_fallback_get_candidates

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

3 calls to language_fallback_get_candidates()
EntityFormController::getFormLangcode in drupal/core/lib/Drupal/Core/Entity/EntityFormController.php
Implements Drupal\Core\Entity\EntityFormControllerInterface::getFormLangcode().
Field::query in drupal/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php
Called to add the field to a query.
field_language_fallback in drupal/core/modules/field/field.module
Applies language fallback rules to the fields attached to the given entity.

File

drupal/core/includes/language.inc, line 536
Language Negotiation API.

Code

function language_fallback_get_candidates($type = LANGUAGE_TYPE_CONTENT) {
  $fallback_candidates =& drupal_static(__FUNCTION__);
  if (!isset($fallback_candidates)) {

    // Get languages ordered by weight, add LANGUAGE_NOT_SPECIFIED at the end.
    $fallback_candidates = array_keys(language_list());
    $fallback_candidates[] = LANGUAGE_NOT_SPECIFIED;

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