function DefaultLanguageItem::getDefaultLangcode

Same name and namespace in other branches
  1. 10 core/modules/language/src/DefaultLanguageItem.php \Drupal\language\DefaultLanguageItem::getDefaultLangcode()
  2. 11.x core/modules/language/src/DefaultLanguageItem.php \Drupal\language\DefaultLanguageItem::getDefaultLangcode()
  3. 9 core/modules/language/src/DefaultLanguageItem.php \Drupal\language\DefaultLanguageItem::getDefaultLangcode()
  4. 8.9.x 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.

Deprecated

in drupal:11.4.0 and is removed from drupal:13.0.0. There is no public replacement.

See also

https://www.drupal.org/node/3566774

File

core/modules/language/src/DefaultLanguageItem.php, line 93

Class

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

Namespace

Drupal\language

Code

public function getDefaultLangcode(EntityInterface $entity) {
  @trigger_error(__METHOD__ . '() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. There is no public replacement. See https://www.drupal.org/node/3566774', E_USER_DEPRECATED);
  return $this->getDefaultLanguageCode($entity->getEntityTypeId(), $entity->bundle());
}

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