You are here

public function Price::defaultConfiguration in Commerce Feeds 8

Gets default configuration for this plugin.

Return value

array An associative array with the default configuration.

Overrides FieldTargetBase::defaultConfiguration

File

src/Feeds/Target/Price.php, line 40

Class

Price
Defines a commerce_price field mapper.

Namespace

Drupal\commerce_feeds\Feeds\Target

Code

public function defaultConfiguration() {
  $currency_code = NULL;
  $currencies = \Drupal::entityTypeManager()
    ->getStorage('commerce_currency')
    ->loadMultiple();
  $currency_codes = array_keys($currencies);
  if (count($currency_codes) == 1) {
    $currency_code = reset($currency_codes);
  }
  return [
    'currency_code' => $currency_code,
  ];
}