You are here

public function ConfigImporter::importCurrencyLocale in Currency 8.3

Imports a currency locale.

Parameters

string $locale:

Return value

\Drupal\currency\Entity\CurrencyLocaleInterface|false The imported currency locale or FALSE in case of errors.

Overrides ConfigImporterInterface::importCurrencyLocale

File

src/ConfigImporter.php, line 148

Class

ConfigImporter
Provides a config importer.

Namespace

Drupal\currency

Code

public function importCurrencyLocale($locale) {
  if (!$this->currencyLocaleStorage
    ->load($locale)) {
    $name = 'currency.currency_locale.' . $locale;
    $currency_locale = $this->currencyLocaleStorage
      ->create($this
      ->getConfigStorage()
      ->read($name));
    $currency_locale
      ->save();
    return $currency_locale;
  }
  return FALSE;
}