public function EntityEmbedDisplayBase::getLangcode in Entity Embed 8
Gets the current language code.
Return value
string The langcode present in the 'data-langcode', if present, or the current langcode from the language manager, otherwise.
1 call to EntityEmbedDisplayBase::getLangcode()
- FieldFormatterEntityEmbedDisplayBase::build in src/
EntityEmbedDisplay/ FieldFormatterEntityEmbedDisplayBase.php - Builds the renderable array for this Entity Embed display plugin.
File
- src/
EntityEmbedDisplay/ EntityEmbedDisplayBase.php, line 346
Class
- EntityEmbedDisplayBase
- Defines a base Entity Embed Display implementation.
Namespace
Drupal\entity_embed\EntityEmbedDisplayCode
public function getLangcode() {
$langcode = $this
->getAttributeValue('data-langcode');
if (empty($langcode)) {
$langcode = $this->languageManager
->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)
->getId();
}
return $langcode;
}