You are here

function language_cookie_language_types_info_alter in Language Cookie 8

Same name and namespace in other branches
  1. 7.2 language_cookie.module \language_cookie_language_types_info_alter()
  2. 7 language_cookie.module \language_cookie_language_types_info_alter()

Alters hook_language_types_info().

For determining the URL language, the cookie language method should take precedence over the URL fallback method.

The first method (LanguageNegotiationUrl) attempts to get the language to use for links in the page from the path prefix or the domain. If no language is found there, instead of falling back to the LanguageNegotiationUrlFallback method (which would return the site default language), we attempt to get the language from the cookie first.

See also

language_language_types_info_alter()

https://drupal.org/node/1497272

File

./language_cookie.module, line 28
Language Cookie module.

Code

function language_cookie_language_types_info_alter(&$language_types) {
  $language_types[LanguageInterface::TYPE_URL]['fixed'] = [
    LanguageNegotiationUrl::METHOD_ID,
    LanguageNegotiationCookie::METHOD_ID,
    LanguageNegotiationUrlFallback::METHOD_ID,
  ];
}