1 field.api.php hook_field_available_languages_alter(&$languages, $context)

Alter field_available_languages() values.

This hook is invoked from field_available_languages() to allow modules to alter the array of available languages for the given field.


$languages: A reference to an array of language codes to be made available.

$context: An associative array containing:

  • entity_type: The type of the entity the field is attached to.
  • field: A field data structure.

Related topics


core/modules/field/field.api.php, line 1628
Hooks provided by the Field module.


function hook_field_available_languages_alter(&$languages, $context) {
  // Add an unavailable language.
  $languages[] = 'xx';

  // Remove an available language.
  $index = array_search('yy', $languages);