LocaleDefaultConfigStorage::read

public LocaleDefaultConfigStorage::read($name)

Read a configuration from install storage or default languages.

Parameters

string $name: Configuration object name.

Return value

array Configuration data from install storage or default language.

File

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

Class

LocaleDefaultConfigStorage
Provides access to default configuration for locale integration.

Namespace

Drupal\locale

Code

public function read($name) {
  if ($this->requiredInstallStorage->exists($name)) {
    return $this->requiredInstallStorage->read($name);
  }
  elseif ($this->optionalInstallStorage->exists($name)) {
    return $this->optionalInstallStorage->read($name);
  }
  elseif (strpos($name, 'language.entity.') === 0) {
    // Simulate default languages as if they were shipped as default
    // configuration.
    $langcode = str_replace('language.entity.', '', $name);
    $predefined_languages = $this->languageManager->getStandardLanguageList();
    if (isset($predefined_languages[$langcode])) {
      $data = $this->configStorage->read($name);
      $data['label'] = $predefined_languages[$langcode][0];
      return $data;
    }
  }
}
doc_Drupal
2016-10-29 09:24:02
Comments
Leave a Comment

Please login to continue.