You are here

function uc_cybersource_form_alter in Ubercart 6.2

Same name and namespace in other branches
  1. 5 payment/uc_cybersource/uc_cybersource.module \uc_cybersource_form_alter()

Implements hook_form_alter().

File

payment/uc_cybersource/uc_cybersource.module, line 53
A module used for CyberSource's Silent Order POST and Hosted Order Page methods of payment.

Code

function uc_cybersource_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'uc_payment_gateways_form') {
    $form['#submit'][] = 'uc_cybersource_payment_gateway_settings_submit';
  }

  // Add to the review page hidden form fields with data to post to CyberSource HOP.
  if ($form_id == 'uc_cart_checkout_review_form' && ($order_id = intval($_SESSION['cart_order'])) > 0) {
    $order = uc_order_load($order_id);
    if ($order->payment_method == 'cybersource_hop') {
      unset($form['submit']);
      $form['#prefix'] = '<table style="display: inline; padding-top: 1em;"><tr><td>';
      $form['#suffix'] = '</td><td>' . drupal_get_form('uc_cybersource_hop_form', $order) . '</td></tr></table>';
    }
  }
}