You are here

public function PaymentMethodAddForm::submitCreditCardForm in Commerce Stripe 8

Handles the submission of the credit card form.

Parameters

array $element: The credit card form element.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the complete form.

Overrides PaymentMethodAddForm::submitCreditCardForm

File

src/PluginForm/Stripe/PaymentMethodAddForm.php, line 111

Class

PaymentMethodAddForm
Provides payment form for Stripe.

Namespace

Drupal\commerce_stripe\PluginForm\Stripe

Code

public function submitCreditCardForm(array $element, FormStateInterface $form_state) {
  if ($email = $form_state
    ->getValue([
    'contact_information',
    'email',
  ])) {
    $email_parents = array_merge($element['#parents'], [
      'email',
    ]);
    $form_state
      ->setValue($email_parents, $email);
  }
}