public function CurrencyHelper::getCurrencies in Commerce Currency Resolver 8
Return formatted array of available currencies.
Return value
array List of keyed currencies ['HRK' => 'Croatian Kuna'].
Overrides CurrencyHelperInterface::getCurrencies
File
- src/
CurrencyHelper.php, line 95
Class
- CurrencyHelper
- Helper for various parts of the module.
Namespace
Drupal\commerce_currency_resolverCode
public function getCurrencies() {
/** @var \Drupal\commerce_price\Entity\CurrencyInterface[] $currencies */
$currencies = $this->entityTypeManager
->getStorage('commerce_currency')
->loadMultiple();
// Set defaults.
$active_currencies = [];
foreach ($currencies as $currency) {
if ($currency
->status()) {
$active_currencies[$currency
->getCurrencyCode()] = $currency
->getName();
}
}
return $active_currencies;
}