public function LangcodeTrait::getLangcode in Coder 8.3
Same name and namespace in other branches
- 8.2 coder_sniffer/DrupalPractice/Test/good/good.php \LangcodeTrait::getLangcode()
- 8.3.x tests/DrupalPractice/good/good.php \LangcodeTrait::getLangcode()
Get code of currently active language.
Return value
string Language code.
File
- tests/
DrupalPractice/ good/ good.php, line 115
Class
- LangcodeTrait
- A trait containing helper methods for language handling.
Code
public function getLangcode() {
if (!isset($this->langcode)) {
$lang = \Drupal::languageManager()
->getCurrentLanguage();
$this
->setLangcode($lang
->getId());
}
return $this->langcode;
}