function LanguageTestTrait::createLanguageFromLangcode
Same name in other branches
- 10 core/modules/language/tests/src/Traits/LanguageTestTrait.php \Drupal\Tests\language\Traits\LanguageTestTrait::createLanguageFromLangcode()
Creates a configurable language object from a langcode.
Parameters
string $langcode: The language code to use to create the object.
Return value
\Drupal\Core\Language\ConfigurableLanguageInterface The created language.
See also
\Drupal\Core\Language\LanguageManager::getStandardLanguageList()
20 calls to LanguageTestTrait::createLanguageFromLangcode()
- ContentTranslationContextualLinksTest::setUp in core/
modules/ content_translation/ tests/ src/ Functional/ ContentTranslationContextualLinksTest.php - ContentTranslationLanguageChangeTest::setUp in core/
modules/ content_translation/ tests/ src/ Functional/ ContentTranslationLanguageChangeTest.php - ContentTranslationOperationsTest::setUp in core/
modules/ content_translation/ tests/ src/ Functional/ ContentTranslationOperationsTest.php - DisplayFeedTranslationTest::setUp in core/
modules/ views/ tests/ src/ Functional/ Plugin/ DisplayFeedTranslationTest.php - Sets up the test.
- EntityReferenceFieldTranslatedReferenceViewTest::setUpLanguages in core/
modules/ field/ tests/ src/ Functional/ EntityReference/ EntityReferenceFieldTranslatedReferenceViewTest.php - Adds additional languages.
File
-
core/
modules/ language/ tests/ src/ Traits/ LanguageTestTrait.php, line 30
Class
- LanguageTestTrait
- Provides an API to programmatically manage languages in tests.
Namespace
Drupal\Tests\language\TraitsCode
public static function createLanguageFromLangcode(string $langcode) : ConfigurableLanguageInterface {
$configurable_language = ConfigurableLanguage::createFromLangcode($langcode);
$configurable_language->save();
return $configurable_language;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.