You are here

public static function CustomLanguageManager::getCustomLanguageList in Custom Language field 8

Gets the list of Custom languages as an array.

Resembling getStandardLanguageList.

Return value

array Array of languages.

4 calls to CustomLanguageManager::getCustomLanguageList()
CustomLanguageManager::createFromLangcode in src/Entity/CustomLanguageManager.php
Creates a configurable language object from a langcode.
LanguageItem::getNativeName in src/Plugin/Field/FieldType/LanguageItem.php
Gets the Native name. (Should be added to \Drupal\Core\Language\Language.)
LanguageItem::getPossibleOptions in src/Plugin/Field/FieldType/LanguageItem.php
LanguageToCode::tamper in src/Plugin/Tamper/LanguageToCode.php
Tamper data.

File

src/Entity/CustomLanguageManager.php, line 96

Class

CustomLanguageManager
Defines the CustomLanguage entity.

Namespace

Drupal\languagefield\Entity

Code

public static function getCustomLanguageList() {
  $result = [];
  $languages = CustomLanguageManager::getCustomLanguages();
  foreach ($languages as $language) {
    $result[$language
      ->id()] = [
      $language
        ->label(),
      $language
        ->getNativeName(),
    ];
  }
  return $result;
}