You are here

function commerce_braintree_commerce_cardonfile_payment_terminal_form_alter in Commerce Braintree 7.2

Same name and namespace in other branches
  1. 7.3 modules/commerce_braintree_dropin/commerce_braintree_dropin.module \commerce_braintree_commerce_cardonfile_payment_terminal_form_alter()

Implements hook_commerce_cardonfile_payment_terminal_form_alter().

File

modules/commerce_braintree_dropin/commerce_braintree_dropin.module, line 104
Provides integration with Braintree Drop-in UI.

Code

function commerce_braintree_commerce_cardonfile_payment_terminal_form_alter(&$form, &$form_state) {

  // Drop-in UI has it's own interface for card on file, so we disable
  // access to the cardonfile form elements when drop-in is selected.
  if (!empty($form['payment_terminal']['payment_details']['cardonfile']) && !empty($form_state['payment_method']['base']) && $form_state['payment_method']['base'] == 'commerce_braintree_dropin') {
    $form['payment_terminal']['payment_details']['cardonfile']['#access'] = FALSE;
  }
}