You are here

function language_cookie_test_store_language_negotiation in Language Cookie 8

Store the last negotiated languages.

1 call to language_cookie_test_store_language_negotiation()
language_cookie_test_page_top in tests/modules/language_cookie_test/language_cookie_test.module
Implements hook_page_top().

File

tests/modules/language_cookie_test/language_cookie_test.module, line 20
Module for language_cookie testing.

Code

function language_cookie_test_store_language_negotiation() {
  $last = [];
  foreach (\Drupal::languageManager()
    ->getDefinedLanguageTypes() as $type) {
    $last[$type] = \Drupal::languageManager()
      ->getCurrentLanguage($type)
      ->getId();
  }
  \Drupal::state()
    ->set('language_cookie_test.language_negotiation_last', $last);
}