function hook_language_fallback_candidates_alter

Same name and namespace in other branches
  1. 7.x modules/system/language.api.php \hook_language_fallback_candidates_alter()
  2. 8.9.x core/modules/language/language.api.php \hook_language_fallback_candidates_alter()
  3. 10 core/modules/language/language.api.php \hook_language_fallback_candidates_alter()
  4. 11.x core/modules/language/language.api.php \hook_language_fallback_candidates_alter()

Allow modules to alter the language fallback candidates.

Parameters

array $candidates: An array of language codes whose order will determine the language fallback order.

array $context: A language fallback context.

See also

\Drupal\Core\Language\LanguageManagerInterface::getFallbackCandidates()

Related topics

2 functions implement hook_language_fallback_candidates_alter()

Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.

LanguageTestHooks::languageFallbackCandidatesAlter in core/modules/language/tests/language_test/src/Hook/LanguageTestHooks.php
Implements hook_language_fallback_candidates_alter().
language_test_language_fallback_candidates_alter in core/modules/language/tests/language_test/language_test.module
Implements hook_language_fallback_candidates_alter().

File

core/modules/language/language.api.php, line 91

Code

function hook_language_fallback_candidates_alter(array &$candidates, array $context) {
    $candidates = array_reverse($candidates);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.