payment_method == 'paypal_wps') { $wps_form = uc_paypal_wps_form($form_state, $order); $wps_url = $wps_form['#action'] . '?'; foreach (element_children($wps_form) as $key) { $wps_url .= urlencode($key) . '=' . urlencode($wps_form[$key]['#value']) . '&'; } $wps_url = trim($wps_url, '&'); drupal_goto($wps_url); } else { // Now submit the form. Obviously the $form_state isn't actually // correct... hopefully nothing will care. uc_cart_checkout_review_form_submit($form, $form_state); // And check for an error. if ($form_state['redirect'] == 'cart/checkout/review') { // There's an error, so pretend the user clicked back. uc_cart_checkout_review_form_back($form, $form_state); } } // Ultimately the $form_state changes made by functions above are used. } elseif ($form_state['redirect'] != 'cart/checkout') { // Log any unexpected URLs in 'redirect'. watchdog('uc_cart', 'Checkout returned unexpected destination url: %url', array('%url' => $form_state['redirect']), WATCHDOG_DEBUG); } } /** * Implementation of hook_form_alter(). * * Changes text on review order button to submit order and adds our custom submit function. * Adds a "Skip checkout review" option to checkout settings form. */ function uc_optional_checkout_review_form_alter(&$form, $form_state, $form_id) { switch ($form_id) { case 'uc_cart_checkout_form': if (variable_get('uc_checkout_skip_review', FALSE)) { // Change the submit button label. $form['continue']['#value'] = variable_get('uc_checkout_submit_button', t('Submit order')); // Add our submit handler. $form['#submit'][] = 'uc_optional_checkout_review_form_submit'; // And add our JavaScript file to handle this submit button. drupal_add_js(drupal_get_path('module', 'uc_optional_checkout_review') .'/uc_optional_checkout_review.js'); // Add the uc_cart css, since it contains the throbber styles that we are using in the JavaScript. drupal_add_css(drupal_get_path('module', 'uc_cart') .'/uc_cart.css'); } break; case 'uc_cart_checkout_settings_form': // Add a checkbox for enabling this module. $form['general']['uc_checkout_skip_review'] = array( '#type' => 'checkbox', '#title' => t('Skip checkout review.'), '#default_value' => variable_get('uc_checkout_skip_review', FALSE), ); break; } }