You are here

function pay_form::currency_list in Pay 7

Same name and namespace in other branches
  1. 6 includes/handlers/pay_form.inc \pay_form::currency_list()

List of all currencies available for this form.

File

includes/handlers/pay_form.inc, line 68
The base class for payment activities. All payment form classes should extend this.

Class

pay_form
@file The base class for payment activities. All payment form classes should extend this.

Code

function currency_list() {
  if (!isset($this->currency_list)) {

    // By default, return the one globally-selected currency.
    $global = pay_currency_list();
    $this->currency_list = array(
      $this
        ->currency() => $global[$this
        ->currency()],
    );

    // Multiple currency support is handled by a separate module that must
    // set this variable and deal with the conversion fallout responsibly.
    if (variable_get('pay_currency_multiple', FALSE)) {
      foreach ($this
        ->pay_methods() as $method) {
        foreach ($method
          ->available_currencies() as $currency) {
          if (!isset($this->currency_list[$currency])) {
            $this->currency_list[$currency] = $currency;
          }
        }
      }
    }
    drupal_alter('pay_currency_list', $this->currency_list);
  }
  return $this->currency_list;
}