function LocaleDefaultConfigStorage::predefinedConfiguredLanguages

Same name in other branches
  1. 9 core/modules/locale/src/LocaleDefaultConfigStorage.php \Drupal\locale\LocaleDefaultConfigStorage::predefinedConfiguredLanguages()
  2. 8.9.x core/modules/locale/src/LocaleDefaultConfigStorage.php \Drupal\locale\LocaleDefaultConfigStorage::predefinedConfiguredLanguages()
  3. 11.x 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);
}

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