You are here

function pay_currency_list in Pay 6

Same name and namespace in other branches
  1. 7 pay.module \pay_currency_list()

Helper function to list all possible currencies.

This function returns a superset of all currencies supported by all payment methods installed on this site.

2 calls to pay_currency_list()
pay_admin_settings in includes/pay.admin.inc
Overall settings form for global payment options.
pay_form::currency_list in includes/handlers/pay_form.inc
List of all currencies available for this form.

File

./pay.module, line 443
Pay module allows for accepting payments using pluggable payment backends.

Code

function pay_currency_list() {
  static $list;
  if (!isset($list)) {

    // Gather a list of all supported currencies.
    $currencies = $list = array();
    foreach (pay_handlers('pay_method') as $name => $info) {
      if ($method = pay_method_load($name)) {
        $currencies = array_merge($currencies, $method
          ->available_currencies());
      }
    }

    // Create a sorted key => value array.
    foreach ($currencies as $item) {
      $list[$item] = $item;
    }
    ksort($list);
    drupal_alter('pay_currency_list', $list);
  }
  return $list;
}