You are here

protected function CommerceCurrencyResolverForm::getAvailableMapping in Commerce Currency Resolver 8

Get all available option where currency could be mapped.

Return value

array Array of options available for currency mapping.

1 call to CommerceCurrencyResolverForm::getAvailableMapping()
CommerceCurrencyResolverForm::buildForm in src/Form/CommerceCurrencyResolverForm.php
Form constructor.

File

src/Form/CommerceCurrencyResolverForm.php, line 145

Class

CommerceCurrencyResolverForm
Class CommerceCurrencyResolverForm.

Namespace

Drupal\commerce_currency_resolver\Form

Code

protected function getAvailableMapping() {
  $mapping = [];

  // Default store.
  $mapping['store'] = $this
    ->t('Store (default Commerce 2 behavior)');
  $mapping['cookie'] = $this
    ->t('Cookie (currency block selector)');

  // Check if exist geo based modules.
  // We support for now two of them.
  if (!empty($this->currencyHelper
    ->getGeoModules())) {
    $mapping['geo'] = $this
      ->t('By Country');
  }

  // Check if the site is multilingual.
  if (count($this->currencyHelper
    ->getLanguages()) > 1) {
    $mapping['lang'] = $this
      ->t('By Language');
  }
  return $mapping;
}