From b1a5bc197e3177f42025757f6fc6146c25f03a43 Mon Sep 17 00:00:00 2001 From: Ricardo Martins Date: Wed, 21 Feb 2018 20:29:08 +1100 Subject: [PATCH] Remove non-allowed currencies from the currencies dropdown in the Magento Setup --- lib/internal/Magento/Framework/Setup/Lists.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/internal/Magento/Framework/Setup/Lists.php b/lib/internal/Magento/Framework/Setup/Lists.php index ce0dd8348acc3..b437969c0af09 100644 --- a/lib/internal/Magento/Framework/Setup/Lists.php +++ b/lib/internal/Magento/Framework/Setup/Lists.php @@ -21,12 +21,20 @@ class Lists */ protected $allowedLocales; + /** + * List of allowed currencies + * + * @var array + */ + protected $allowedCurrencies; + /** * @param ConfigInterface $localeConfig */ public function __construct(ConfigInterface $localeConfig) { $this->allowedLocales = $localeConfig->getAllowedLocales(); + $this->allowedCurrencies = $localeConfig->getAllowedCurrencies(); } /** @@ -64,6 +72,10 @@ public function getCurrencyList() $currencies = (new CurrencyBundle())->get(Resolver::DEFAULT_LOCALE)['Currencies']; $list = []; foreach ($currencies as $code => $data) { + $isAllowedCurrency = array_search($code, $this->allowedCurrencies) !== false; + if (!$isAllowedCurrency) { + continue; + } $list[$code] = $data[1] . ' (' . $code . ')'; } asort($list);