function language_language_types_info_alter

Same name in other branches
  1. 8.9.x core/modules/language/language.module \language_language_types_info_alter()
  2. 10 core/modules/language/language.module \language_language_types_info_alter()
  3. 11.x core/modules/language/language.module \language_language_types_info_alter()

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.

File

core/modules/language/language.module, line 442

Code

function language_language_types_info_alter(array &$language_types) {
    $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.