You are here

public function PaymentMethodFormBase::submitConfigurationForm in Commerce Core 8.2

Form submission 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 PluginFormInterface::submitConfigurationForm

2 calls to PaymentMethodFormBase::submitConfigurationForm()
PaymentMethodAddForm::submitConfigurationForm in modules/payment/src/PluginForm/PaymentMethodAddForm.php
Form submission handler.
PaymentMethodEditForm::submitConfigurationForm in modules/payment/src/PluginForm/PaymentMethodEditForm.php
Form submission handler.
2 methods override PaymentMethodFormBase::submitConfigurationForm()
PaymentMethodAddForm::submitConfigurationForm in modules/payment/src/PluginForm/PaymentMethodAddForm.php
Form submission handler.
PaymentMethodEditForm::submitConfigurationForm in modules/payment/src/PluginForm/PaymentMethodEditForm.php
Form submission handler.

File

modules/payment/src/PluginForm/PaymentMethodFormBase.php, line 119

Class

PaymentMethodFormBase

Namespace

Drupal\commerce_payment\PluginForm

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {

  /** @var \Drupal\commerce_payment\Plugin\Commerce\PaymentGateway\OnsitePaymentGatewayInterface $payment_gateway_plugin */
  $payment_gateway_plugin = $this->plugin;

  /** @var \Drupal\commerce_payment\Entity\PaymentMethodInterface $payment_method */
  $payment_method = $this->entity;
  if ($payment_gateway_plugin
    ->collectsBillingInformation()) {

    /** @var \Drupal\commerce\Plugin\Commerce\InlineForm\EntityInlineFormInterface $inline_form */
    $inline_form = $form['billing_information']['#inline_form'];

    /** @var \Drupal\profile\Entity\ProfileInterface $billing_profile */
    $billing_profile = $inline_form
      ->getEntity();
    $payment_method
      ->setBillingProfile($billing_profile);
  }
}