public function LocaleConfigManager::get

Gets locale wrapper with typed configuration data.

Parameters

string $name: Configuration object name.

Return value

\Drupal\locale\LocaleTypedConfig Locale-wrapped configuration element.

Overrides TypedConfigManager::get

File

drupal/core/modules/locale/lib/Drupal/locale/LocaleConfigManager.php, line 67
Contains \Drupal\locale\LocaleConfigManager.

Class

LocaleConfigManager
Manages localized configuration type plugins.

Namespace

Drupal\locale

Code

public function get($name) {

  // Read default and current configuration data.
  $default = $this->installStorage
    ->read($name);
  $updated = $this->configStorage
    ->read($name);

  // We get only the data that didn't change from default.
  $data = $this
    ->compareConfigData($default, $updated);
  $definition = $this
    ->getDefinition($name);

  // Unless the configuration has a explicit language code we assume English.
  $langcode = isset($default['langcode']) ? $default['langcode'] : 'en';
  $wrapper = new LocaleTypedConfig($definition, $name, $langcode, $this);
  $wrapper
    ->setValue($data);
  return $wrapper;
}