function commerce_cardonfile_card_form_page in Commerce Card on File 7.2
Returns the appropriate card form.
1 string reference to 'commerce_cardonfile_card_form_page'
- commerce_cardonfile_menu in ./
commerce_cardonfile.module - Implements hook_menu().
File
- includes/
commerce_cardonfile.pages.inc, line 64 - User page callbacks and forms for Commerce Card on File.
Code
function commerce_cardonfile_card_form_page($op, $card, $account) {
$payment_method = commerce_payment_method_instance_load($card->instance_id);
if ($op == 'update') {
// This is not likely to happen, but if the payment method doesn't implement
// the update callback, redirect the user back to the card listing page and
// inform them about the error.
if (!isset($payment_method['cardonfile']['update callback'])) {
drupal_set_message(t('We encountered an error attempting to update your card data. Please try again and contact us if this error persists.'), 'error');
drupal_goto('user/' . $card->uid . '/cards');
}
}
else {
drupal_set_title(t('Add a card'));
// Card data was initialized with the anonymous user as its owner. Set the
// owner here to the user from the menu item, so that the form will receive
// the complete information that is needed to save the card.
$card->uid = $account->uid;
}
if ($form_callback = commerce_cardonfile_payment_method_callback($payment_method, $op . ' form callback')) {
return drupal_get_form($form_callback, $op, $card);
}
else {
return drupal_get_form('commerce_cardonfile_card_form', $op, $card);
}
}