You are here

public function CurrencyRepository::getList in Price 8

Same name and namespace in other branches
  1. 3.x src/Repository/CurrencyRepository.php \Drupal\price\Repository\CurrencyRepository::getList()
  2. 2.0.x src/Repository/CurrencyRepository.php \Drupal\price\Repository\CurrencyRepository::getList()
  3. 2.x src/Repository/CurrencyRepository.php \Drupal\price\Repository\CurrencyRepository::getList()
  4. 3.0.x src/Repository/CurrencyRepository.php \Drupal\price\Repository\CurrencyRepository::getList()

File

src/Repository/CurrencyRepository.php, line 70

Class

CurrencyRepository
Defines the currency repository.

Namespace

Drupal\price\Repository

Code

public function getList($locale = NULL) {
  $list = [];

  /** @var \Drupal\price\Entity\CurrencyInterface[] $entities */
  $currencies = $this->currencyStorage
    ->loadMultiple();
  foreach ($currencies as $currency_code => $currency) {
    $list[$currency_code] = $currency
      ->getName();
  }
  return $list;
}