hook_language_fallback_candidates_OPERATION_alter(array &$candidates, array $context)
Allow modules to alter the fallback candidates for specific operations.
array $candidates: An array of language codes whose order will determine the language fallback order.
array $context: A language fallback context.
\Drupal\Core\Language\LanguageManagerInterface::getFallbackCandidates()
function hook_language_fallback_candidates_OPERATION_alter(array &$candidates, array $context) { // We know that the current OPERATION deals with entities so no need to check // here. if ($context['data']->getEntityTypeId() == 'node') { $candidates = array_reverse($candidates); } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!language!language.api.php/function/hook_language_fallback_candidates_OPERATION_alter/8.1.x