You are here

function commerce_paypal_checkout_disable_card_validate in Commerce PayPal 7.2

Element validate callback for the disable_card payment method setting.

1 string reference to 'commerce_paypal_checkout_disable_card_validate'
commerce_paypal_checkout_settings_form in modules/checkout/commerce_paypal_checkout.module
Payment method callback: settings form.

File

modules/checkout/commerce_paypal_checkout.module, line 476
Implements PayPal Checkout in Drupal Commerce checkout.

Code

function commerce_paypal_checkout_disable_card_validate($element, &$form_state, $form) {
  $parents = $element['#parents'];
  array_pop($parents);
  $parents[] = 'disable_funding';
  $disable_funding = drupal_array_get_nested_value($form_state['values'], $parents);

  // When the "card" funding source is disabled, the "disable_card" setting
  // cannot be specified.
  if (isset($disable_funding['card'])) {
    $element['#value'] = array();
  }
  form_set_value($element, array_filter($element['#value']), $form_state);
}