function uc_paypal_form_alter in Ubercart 6.2
Same name and namespace in other branches
- 5 payment/uc_paypal/uc_paypal.module \uc_paypal_form_alter()
Implements hook_form_alter().
Notice how we alter the checkout review form to post the order to PayPal.
File
- payment/
uc_paypal/ uc_paypal.module, line 99 - Integrates various PayPal payment services and Instant Payment Notifications (IPN) with Ubercart!
Code
function uc_paypal_form_alter(&$form, $form_state, $form_id) {
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 == 'paypal_wps') {
unset($form['submit']);
$form['#prefix'] = '<table style="display: inline; padding-top: 1em;"><tr><td>';
$form['#suffix'] = '</td><td>' . drupal_get_form('uc_paypal_wps_form', $order) . '</td></tr></table>';
}
}
if ($form_id == 'uc_cart_checkout_form' && variable_get('uc_payment_method_paypal_ec_checkout', FALSE)) {
$form['#submit'][] = 'uc_paypal_ec_checkout';
}
if ($form_id == 'uc_cart_checkout_review_form' && !empty($_SESSION['TOKEN'])) {
$form['#submit'][] = 'uc_paypal_ec_submit_form_submit';
}
}