You are here

function _uc_payment_gateway_list in Ubercart 7.3

Builds a list of payment gateways defined in the enabled modules.

5 calls to _uc_payment_gateway_list()
uc_credit_default_gateway in payment/uc_credit/uc_credit.module
Retrieves the ID of the default credit card gateway.
uc_credit_settings_form in payment/uc_credit/uc_credit.admin.inc
Credit card settings form.
uc_payment_methods_form in payment/uc_payment/uc_payment.admin.inc
Displays an overview of the available payment methods.
uc_payment_process_payment in payment/uc_payment/uc_payment.module
Processes a payment through an enabled payment gateway.
_uc_payment_gateway_data in payment/uc_payment/uc_payment.module
Returns data from a payment gateway by gateway ID and the array key.

File

payment/uc_payment/uc_payment.module, line 633

Code

function _uc_payment_gateway_list($filter = NULL, $enabled_only = FALSE) {
  $gateways = array();
  foreach (module_invoke_all('uc_payment_gateway') as $id => $gateway) {

    // Preserve backward compatibility for gateways with no key specified.
    if (is_numeric($id)) {
      $id = $gateway['id'];
    }
    $gateways[$id] = array_merge($gateway, array(
      'id' => $id,
      'enabled' => variable_get('uc_pg_' . $id . '_enabled', TRUE),
    ));
  }

  // Allow other modules to alter the payment gateways.
  drupal_alter('uc_payment_gateway', $gateways);
  foreach ($gateways as $id => $gateway) {
    if ($filter && (!isset($gateway[$filter]) || !function_exists($gateway[$filter]))) {
      unset($gateways[$id]);
      continue;
    }
    if ($enabled_only && !$gateway['enabled']) {
      unset($gateways[$id]);
    }
  }
  return $gateways;
}