function ConfigurableLanguage::getDefaultLangcode

Same name in other branches
  1. 9 core/modules/language/src/Entity/ConfigurableLanguage.php \Drupal\language\Entity\ConfigurableLanguage::getDefaultLangcode()
  2. 10 core/modules/language/src/Entity/ConfigurableLanguage.php \Drupal\language\Entity\ConfigurableLanguage::getDefaultLangcode()
  3. 11.x core/modules/language/src/Entity/ConfigurableLanguage.php \Drupal\language\Entity\ConfigurableLanguage::getDefaultLangcode()

Gets the default langcode.

Return value

string The current default langcode.

2 calls to ConfigurableLanguage::getDefaultLangcode()
ConfigurableLanguage::isDefault in core/modules/language/src/Entity/ConfigurableLanguage.php
Returns whether this language is the default language.
ConfigurableLanguage::preDelete in core/modules/language/src/Entity/ConfigurableLanguage.php

File

core/modules/language/src/Entity/ConfigurableLanguage.php, line 212

Class

ConfigurableLanguage
Defines the ConfigurableLanguage entity.

Namespace

Drupal\language\Entity

Code

protected static function getDefaultLangcode() {
    $language = \Drupal::service('language.default')->get();
    return $language->getId();
}

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