function LanguageManagerInterface::getFallbackCandidates

Same name in other branches
  1. 9 core/lib/Drupal/Core/Language/LanguageManagerInterface.php \Drupal\Core\Language\LanguageManagerInterface::getFallbackCandidates()
  2. 8.9.x core/lib/Drupal/Core/Language/LanguageManagerInterface.php \Drupal\Core\Language\LanguageManagerInterface::getFallbackCandidates()
  3. 11.x core/lib/Drupal/Core/Language/LanguageManagerInterface.php \Drupal\Core\Language\LanguageManagerInterface::getFallbackCandidates()

Returns the language fallback candidates for a given context.

Parameters

array $context: (optional) An associative array of data that can be useful to determine the fallback sequence. The following keys are used in core:

  • langcode: Language code of the desired language.
  • operation: The name of the operation indicating the context where language fallback is being applied. The following operations are defined in core, but more may be defined in contributed modules:

    • entity_view: Invoked when an entity is about to be displayed. The data key contains the loaded entity.
    • views_query: Invoked when a field based views query is performed. The data key contains a reference to the field object.
    • locale_lookup: Invoked when a string translation was not found. The data key contains the source string.
  • data: A data structure that makes sense in the provided context, see above.

Return value

array An array of language codes sorted by priority: first values should be tried first.

File

core/lib/Drupal/Core/Language/LanguageManagerInterface.php, line 164

Class

LanguageManagerInterface
Common interface for the language manager service.

Namespace

Drupal\Core\Language

Code

public function getFallbackCandidates(array $context = []);

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