function hook_field_language_alter

Perform alterations on field_language() values.

This hook is invoked to alter the array of display language codes for the given entity.

Parameters

$display_langcode: A reference to an array of language codes keyed by field name.

$context: An associative array containing:

  • entity: The entity with fields to render.
  • langcode: The language code $entity has to be displayed in.

Related topics

2 functions implement hook_field_language_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

field_test_field_language_alter in drupal/core/modules/field/tests/modules/field_test/field_test.module
Implements hook_field_language_alter().
translation_entity_field_language_alter in drupal/core/modules/translation_entity/translation_entity.module
Implements hook_field_language_alter().

File

drupal/core/modules/field/field.api.php, line 1107

Code

function hook_field_language_alter(&$display_langcode, $context) {

  // Do not apply core language fallback rules if they are disabled or if Locale
  // is not registered as a translation handler.
  if (field_language_fallback_enabled() && field_has_translation_handler($context['entity']
    ->entityType())) {
    field_language_fallback($display_langcode, $context['entity'], $context['langcode']);
  }
}