Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DefaultLanguageItem.php

function 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 45

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());
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal