function LanguageHooks::languageTypesInfoAlter

Implements hook_language_types_info_alter().

We can't set the fixed properties in \Drupal\Core\Language\LanguageManager, where the rest of the properties for the default language types are defined. The LanguageNegation classes are only loaded when the language module is enabled and we can't be sure of that in the LanguageManager.

Attributes

#[Hook('language_types_info_alter')]

File

core/modules/language/src/Hook/LanguageHooks.php, line 357

Class

LanguageHooks
Hook implementations for language.

Namespace

Drupal\language\Hook

Code

public function languageTypesInfoAlter(array &$language_types) : void {
  $language_types[LanguageInterface::TYPE_CONTENT]['fixed'] = [
    LanguageNegotiationUI::METHOD_ID,
  ];
  $language_types[LanguageInterface::TYPE_URL]['fixed'] = [
    LanguageNegotiationUrl::METHOD_ID,
    LanguageNegotiationUrlFallback::METHOD_ID,
  ];
}

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