function LanguageTestHooks::storeLanguageNegotiation

Store the last negotiated languages.

1 call to LanguageTestHooks::storeLanguageNegotiation()
LanguageTestHooks::pageTop in core/modules/language/tests/language_test/src/Hook/LanguageTestHooks.php
Implements hook_page_top().

File

core/modules/language/tests/language_test/src/Hook/LanguageTestHooks.php, line 121

Class

LanguageTestHooks
Hook implementations for language_test.

Namespace

Drupal\language_test\Hook

Code

public function storeLanguageNegotiation() : void {
    $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.