function hook_field_language_alter

Perform alterations on field_language() values.

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

Parameters

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

$context: An associative array containing:

  • entity_type: The type of the entity to be displayed.
  • 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 modules/field/tests/field_test.module
Implements hook_field_language_alter().
locale_field_language_alter in modules/locale/locale.module
Implements hook_field_language_alter().

File

modules/field/field.api.php, line 1556

Code

function hook_field_language_alter(&$display_language, $context) {
    // Do not apply core language fallback rules if they are disabled or if Locale
    // is not registered as a translation handler.
    if (variable_get('locale_field_language_fallback', TRUE) && field_has_translation_handler($context['entity_type'], 'locale')) {
        locale_field_language_fallback($display_language, $context['entity'], $context['language']);
    }
}

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