function commerce_payment_payment_transaction_delete_form in Commerce Core 7
Form callback: confirmation form for deleting a transaction.
Parameters
$transaction: The payment transaction object to be deleted.
See also
1 string reference to 'commerce_payment_payment_transaction_delete_form'
- commerce_payment_ui_forms in modules/
payment/ commerce_payment_ui.module - Implements hook_forms().
File
- modules/
payment/ includes/ commerce_payment.forms.inc, line 254 - Defines forms for creating and administering payment transactions.
Code
function commerce_payment_payment_transaction_delete_form($form, &$form_state, $order, $transaction) {
$form_state['order'] = $order;
$form_state['transaction'] = $transaction;
// Load and store the payment method.
$payment_method = commerce_payment_method_load($transaction->payment_method);
$form_state['payment_method'] = $payment_method;
// Ensure this include file is loaded when the form is rebuilt from the cache.
$form_state['build_info']['files']['form'] = drupal_get_path('module', 'commerce_payment') . '/includes/commerce_payment.forms.inc';
$form['#submit'][] = 'commerce_payment_payment_transaction_delete_form_submit';
$form = confirm_form($form, t('Are you sure you want to delete this transaction?'), '', '<p>' . t('@amount paid via %method on @date. Deleting this transaction cannot be undone.', array(
'@amount' => commerce_currency_format($transaction->amount, $transaction->currency_code),
'%method' => $payment_method['title'],
'@date' => format_date($transaction->created, 'short'),
)) . '</p>', t('Delete'), t('Cancel'), 'confirm');
return $form;
}