You are here

public function DefaultLanguageItem::getDefaultLangcode in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/language/src/DefaultLanguageItem.php \Drupal\language\DefaultLanguageItem::getDefaultLangcode()

Provides default language code of given entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity whose language code to be loaded.

Return value

string A string language code.

1 call to DefaultLanguageItem::getDefaultLangcode()
DefaultLanguageItem::applyDefaultValue in core/modules/language/src/DefaultLanguageItem.php
Applies the default value.

File

core/modules/language/src/DefaultLanguageItem.php, line 50
Contains \Drupal\language\DefaultLanguageItem.

Class

DefaultLanguageItem
Alternative plugin implementation of the 'language' field type.

Namespace

Drupal\language

Code

public function getDefaultLangcode(EntityInterface $entity) {
  return language_get_default_langcode($entity
    ->getEntityTypeId(), $entity
    ->bundle());
}