You are here

function pay_method_delete_confirm in Pay 7

Menu callback; delete a payment method.

1 string reference to 'pay_method_delete_confirm'
pay_menu_menu in includes/pay.menu.inc
Implementation of hook_menu().

File

includes/pay.admin.inc, line 294
Administration form settings and related functions.

Code

function pay_method_delete_confirm($form, &$form_state, $pay_method) {
  $form['pmid'] = array(
    '#type' => 'value',
    '#value' => $pay_method->pmid,
  );
  if ($pay_method
    ->transactionCount() == 0) {
    $message = t('Are you sure you want to delete the payment method %name?', array(
      '%name' => $pay_method
        ->title(),
    ));
    $caption = '<p>' . t('This action cannot be undone.') . '</p>';
    $button = t('Delete');
  }
  else {
    $message = t('Are you sure you want to disable the payment method %name?', array(
      '%name' => $pay_method
        ->title(),
    ));
    $caption = '<p>' . t('Because there are existing transactions using this payment method it is not possible to delete it. Disabling it will remove it from listings and prevent it from being used for future transactions.') . '</p>';
    $button = t('Disable');
  }
  return confirm_form($form, $message, 'admin/config/pay/method', $caption, $button);
}