function uc_stripe_form_alter in Ubercart Stripe 6.2
implements hook_form_alter() to make sure that we have control of the credit form. It's critical that it have these elements; if we used hook_form_FORMID_alter for this some other module might get an earlier chance at it.
_state _id
Parameters
$form:
File
- ./
uc_stripe.module, line 623 - A stripe.js PCI-compliant payment gateway Forked from Bitcookie's work (thanks!) which was posted at http://bitcookie.com/blog/pci-compliant-ubercart-and-stripe-js from discussion in the uc_stripe issue queue, https://www.drupal.org/node/1467886
Code
function uc_stripe_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'uc_payment_method_credit_form') {
// Make sure tp properly prepare the CC form. Because so much is done
// by AJAX on this page, do this again on cc number change.
$form['cc_number']['#attributes']['onchange'] = 'uc_stripe_clean_cc_form()';
$form['stripe_nojs_warning'] = array(
'#type' => 'item',
'#value' => '<span id="stripe-nojs-warning" class="stripe-warning">' . t('Sorry, for security reasons your card cannot be processed because Javascript is disabled in your browser.') . '</span>',
'#weight' => -1000,
);
$form['stripe_token'] = array(
'#type' => 'hidden',
'#maxlength' => 64,
);
if (!module_exists('uc_optional_checkout_review') || !variable_get('uc_checkout_skip_review', FALSE)) {
unset($form['cc_number'], $form['cc_cvv']);
$form['config_error'] = array(
'#type' => 'markup',
'#value' => t('<span class="stripe-warning">Misconfiguration of cart checkout, see status page</span>'),
);
}
}
}