You are here

public function Basic::submitConfigurationForm in Payment 8.2

Same name in this branch
  1. 8.2 src/Plugin/Payment/MethodConfiguration/Basic.php \Drupal\payment\Plugin\Payment\MethodConfiguration\Basic::submitConfigurationForm()
  2. 8.2 src/Plugin/Payment/LineItem/Basic.php \Drupal\payment\Plugin\Payment\LineItem\Basic::submitConfigurationForm()

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 PaymentMethodConfigurationBase::submitConfigurationForm

File

src/Plugin/Payment/MethodConfiguration/Basic.php, line 315

Class

Basic
Provides the configuration for the payment_basic payment method plugin.

Namespace

Drupal\payment\Plugin\Payment\MethodConfiguration

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::submitConfigurationForm($form, $form_state);
  $this
    ->getExecutePaymentStatusSelector($form_state)
    ->submitSelectorForm($form['plugin_form']['execute']['execute_status'], $form_state);
  $this
    ->getCapturePaymentStatusSelector($form_state)
    ->submitSelectorForm($form['plugin_form']['capture']['plugin_form']['capture_status'], $form_state);
  $this
    ->getRefundPaymentStatusSelector($form_state)
    ->submitSelectorForm($form['plugin_form']['refund']['plugin_form']['refund_status'], $form_state);
  $parents = $form['plugin_form']['brand_label']['#parents'];
  array_pop($parents);
  $values = $form_state
    ->getValues();
  $values = NestedArray::getValue($values, $parents);
  $this
    ->setExecuteStatusId($this
    ->getExecutePaymentStatusSelector($form_state)
    ->getSelectedPlugin()
    ->getPluginId());
  $this
    ->setCapture($values['capture']['capture']);
  $this
    ->setCaptureStatusId($this
    ->getCapturePaymentStatusSelector($form_state)
    ->getSelectedPlugin()
    ->getPluginId());
  $this
    ->setRefund($values['refund']['refund']);
  $this
    ->setRefundStatusId($this
    ->getRefundPaymentStatusSelector($form_state)
    ->getSelectedPlugin()
    ->getPluginId());
  $this
    ->setBrandLabel($values['brand_label']);
}