You are here

protected function LocaleDefaultConfigStorage::predefinedConfiguredLanguages in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/locale/src/LocaleDefaultConfigStorage.php \Drupal\locale\LocaleDefaultConfigStorage::predefinedConfiguredLanguages()
  2. 10 core/modules/locale/src/LocaleDefaultConfigStorage.php \Drupal\locale\LocaleDefaultConfigStorage::predefinedConfiguredLanguages()

Compute the list of configuration names that match predefined languages.

Return value

array The list of configuration names that match predefined languages.

2 calls to LocaleDefaultConfigStorage::predefinedConfiguredLanguages()
LocaleDefaultConfigStorage::getComponentNames in core/modules/locale/src/LocaleDefaultConfigStorage.php
Get all configuration names and folders for a list of modules or themes.
LocaleDefaultConfigStorage::listAll in core/modules/locale/src/LocaleDefaultConfigStorage.php
Return the list of configuration in install storage and current languages.

File

core/modules/locale/src/LocaleDefaultConfigStorage.php, line 149

Class

LocaleDefaultConfigStorage
Provides access to default configuration for locale integration.

Namespace

Drupal\locale

Code

protected function predefinedConfiguredLanguages() {
  $names = $this->configStorage
    ->listAll('language.entity.');
  $predefined_languages = $this->languageManager
    ->getStandardLanguageList();
  foreach ($names as $id => $name) {
    $langcode = str_replace('language.entity.', '', $name);
    if (!isset($predefined_languages[$langcode])) {
      unset($names[$id]);
    }
  }
  return array_values($names);
}