You are here

public function LanguageItem::getNativeName in Custom Language field 8

Gets the Native name. (Should be added to \Drupal\Core\Language\Language.)

File

src/Plugin/Field/FieldType/LanguageItem.php, line 366

Class

LanguageItem
Plugin implementation of the 'language' field type.

Namespace

Drupal\languagefield\Plugin\Field\FieldType

Code

public function getNativeName() {
  $value = $this->value;
  switch ($value) {
    case 'und':
      $name = '';
      break;
    default:
      $standard_languages = \Drupal::languageManager()
        ->getStandardLanguageList();
      $standard_languages += CustomLanguageManager::getCustomLanguageList();
      $name = $standard_languages[$value][1];
      break;
  }
  return $name;
}