function hook_field_available_languages_alter

Alter field_available_languages() values.

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

Parameters

$langcodes: 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

1 function implements hook_field_available_languages_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_available_languages_alter in drupal/core/modules/field/tests/modules/field_test/field_test.module
Implements hook_field_available_languages_alter().

File

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

Code

function hook_field_available_languages_alter(&$langcodes, $context) {

  // Add an unavailable language code.
  $langcodes[] = 'xx';

  // Remove an available language code.
  $index = array_search('yy', $langcodes);
  unset($langcodes[$index]);
}