You are here

interface CurrencyImporterInterface in Commerce Core 8.2

Imports the library-provided currency data into config entities.

Hierarchy

Expanded class hierarchy of CurrencyImporterInterface

All classes that implement CurrencyImporterInterface

1 file declares its use of CurrencyImporterInterface
CurrencyImportForm.php in modules/price/src/Form/CurrencyImportForm.php

File

modules/price/src/CurrencyImporterInterface.php, line 8

Namespace

Drupal\commerce_price
View source
interface CurrencyImporterInterface {

  /**
   * Gets a list of importable currencies.
   *
   * @return array
   *   An array in the currencyCode => name format.
   */
  public function getImportable();

  /**
   * Imports currency data for the given currency code.
   *
   * @param string $currency_code
   *   The currency code.
   *
   * @return \Drupal\commerce_price\Entity\CurrencyInterface
   *   The saved currency entity.
   *
   * @throws \CommerceGuys\Intl\Exception\UnknownCurrencyException
   *   Thrown when the currency couldn't be found in the library definitions.
   */
  public function import($currency_code);

  /**
   * Imports currency data for the given country code.
   *
   * @param string $country_code
   *   The country code.
   *
   * @return \Drupal\commerce_price\Entity\CurrencyInterface|null
   *   The saved currency entity or NULL if the given country's currency
   *   isn't known.
   *
   * @throws \CommerceGuys\Intl\Exception\UnknownCountryException
   *   Thrown when the country couldn't be found in the library definitions.
   */
  public function importByCountry($country_code);

  /**
   * Imports translations for the given language codes.
   *
   * @param array $langcodes
   *   Array of language codes to import translations for.
   */
  public function importTranslations(array $langcodes);

}

Members

Namesort descending Modifiers Type Description Overrides
CurrencyImporterInterface::getImportable public function Gets a list of importable currencies. 1
CurrencyImporterInterface::import public function Imports currency data for the given currency code. 1
CurrencyImporterInterface::importByCountry public function Imports currency data for the given country code. 1
CurrencyImporterInterface::importTranslations public function Imports translations for the given language codes. 1