Same name and namespace in other branches
  1. 7.x modules/system/language.api.php \hook_language_types_info()
  2. 8.9.x core/modules/language/language.api.php \hook_language_types_info()
  3. 9 core/modules/language/language.api.php \hook_language_types_info()

Define language types.

Return value

array An associative array of language type definitions. The keys are the identifiers, which are also used as names for global variables representing the types in the bootstrap phase. The values are associative arrays that may contain the following elements:

  • name: The human-readable language type identifier.
  • description: A description of the language type.
  • locked: A boolean indicating if the user can choose whether to configure the language type or not using the UI.
  • fixed: A fixed array of language negotiation method identifiers to use to initialize this language. If locked is set to TRUE and fixed is set, it will always use the specified methods in the given priority order. If not present and locked is TRUE then language-interface will be used.

@todo Rename the 'fixed' key to something more meaningful, for instance 'negotiation settings'. See https://www.drupal.org/node/2166879.

See also

hook_language_types_info_alter()

Related topics

1 function implements hook_language_types_info()

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

language_test_language_types_info in core/modules/language/tests/language_test/language_test.module
Implements hook_language_types_info().
1 invocation of hook_language_types_info()
ConfigurableLanguageManager::getDefinedLanguageTypesInfo in core/modules/language/src/ConfigurableLanguageManager.php

File

core/modules/language/language.api.php, line 37
Hooks provided by the Language module.

Code

function hook_language_types_info() {
  return [
    'custom_language_type' => [
      'name' => t('Custom language'),
      'description' => t('A custom language type.'),
      'locked' => FALSE,
    ],
    'fixed_custom_language_type' => [
      'locked' => TRUE,
      'fixed' => [
        'custom_language_negotiation_method',
      ],
    ],
  ];
}