W3cubDocs

/Drupal 8

function hook_language_types_info

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

Hooks
Define functions that alter the behavior of Drupal core.

File

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

Code

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!language!language.api.php/function/hook_language_types_info/8.1.x