function LanguageSwitchingTest::saveNativeLanguageName

Same name in other branches
  1. 9 core/modules/language/tests/src/Functional/LanguageSwitchingTest.php \Drupal\Tests\language\Functional\LanguageSwitchingTest::saveNativeLanguageName()
  2. 8.9.x core/modules/language/tests/src/Functional/LanguageSwitchingTest.php \Drupal\Tests\language\Functional\LanguageSwitchingTest::saveNativeLanguageName()
  3. 11.x core/modules/language/tests/src/Functional/LanguageSwitchingTest.php \Drupal\Tests\language\Functional\LanguageSwitchingTest::saveNativeLanguageName()

Saves the native name of a language entity in configuration as a label.

Parameters

string $langcode: The language code of the language.

string $label: The native name of the language.

1 call to LanguageSwitchingTest::saveNativeLanguageName()
LanguageSwitchingTest::testLanguageBlock in core/modules/language/tests/src/Functional/LanguageSwitchingTest.php
Functional tests for the language switcher block.

File

core/modules/language/tests/src/Functional/LanguageSwitchingTest.php, line 696

Class

LanguageSwitchingTest
Functional tests for the language switching feature.

Namespace

Drupal\Tests\language\Functional

Code

protected function saveNativeLanguageName($langcode, $label) {
    \Drupal::service('language.config_factory_override')->getOverride($langcode, 'language.entity.' . $langcode)
        ->set('label', $label)
        ->save();
}

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