function language_test_store_language_negotiation

Same name and namespace in other branches
  1. 9 core/modules/language/tests/language_test/language_test.module \language_test_store_language_negotiation()
  2. 8.9.x core/modules/language/tests/language_test/language_test.module \language_test_store_language_negotiation()
  3. 10 core/modules/language/tests/language_test/language_test.module \language_test_store_language_negotiation()

Store the last negotiated languages.

1 call to language_test_store_language_negotiation()
language_test_page_top in core/modules/language/tests/language_test/language_test.module
Implements hook_page_top().

File

core/modules/language/tests/language_test/language_test.module, line 70

Code

function language_test_store_language_negotiation() {
    $last = [];
    foreach (\Drupal::languageManager()->getDefinedLanguageTypes() as $type) {
        $last[$type] = \Drupal::languageManager()->getCurrentLanguage($type)
            ->getId();
    }
    \Drupal::keyValue('language_test')->set('language_negotiation_last', $last);
}

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