You are here

public function PaymentMethodEditForm::validateConfigurationForm in Commerce Core 8.2

Form validation handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides PaymentMethodFormBase::validateConfigurationForm

File

modules/payment/src/PluginForm/PaymentMethodEditForm.php, line 34

Class

PaymentMethodEditForm

Namespace

Drupal\commerce_payment\PluginForm

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::validateConfigurationForm($form, $form_state);

  /** @var \Drupal\commerce_payment\Entity\PaymentMethodInterface $payment_method */
  $payment_method = $this->entity;
  if ($payment_method
    ->bundle() == 'credit_card') {
    $this
      ->validateCreditCardForm($form['payment_details'], $form_state);
  }
  elseif ($payment_method
    ->bundle() == 'paypal') {

    // @todo Decide how to handle saved PayPal payment methods.
  }
}