protected function PaymentInformation::buildPaymentMethodForm in Commerce Core 8.2
Builds the payment method form for the selected payment option.
Parameters
array $pane_form: The pane form.
\Drupal\Core\Form\FormStateInterface $form_state: The form state of the parent form.
\Drupal\commerce_payment\PaymentOption $payment_option: The payment option.
Return value
array The modified pane form.
1 call to PaymentInformation::buildPaymentMethodForm()
- PaymentInformation::buildPaneForm in modules/
payment/ src/ Plugin/ Commerce/ CheckoutPane/ PaymentInformation.php - Builds the pane form.
File
- modules/
payment/ src/ Plugin/ Commerce/ CheckoutPane/ PaymentInformation.php, line 248
Class
- PaymentInformation
- Provides the payment information pane.
Namespace
Drupal\commerce_payment\Plugin\Commerce\CheckoutPaneCode
protected function buildPaymentMethodForm(array $pane_form, FormStateInterface $form_state, PaymentOption $payment_option) {
$payment_method_storage = $this->entityTypeManager
->getStorage('commerce_payment_method');
assert($payment_method_storage instanceof PaymentMethodStorageInterface);
$payment_method = $payment_method_storage
->createForCustomer($payment_option
->getPaymentMethodTypeId(), $payment_option
->getPaymentGatewayId(), $this->order
->getCustomerId(), $this->order
->getBillingProfile());
$inline_form = $this->inlineFormManager
->createInstance('payment_gateway_form', [
'operation' => 'add-payment-method',
], $payment_method);
$pane_form['add_payment_method'] = [
'#parents' => array_merge($pane_form['#parents'], [
'add_payment_method',
]),
'#inline_form' => $inline_form,
];
$pane_form['add_payment_method'] = $inline_form
->buildInlineForm($pane_form['add_payment_method'], $form_state);
return $pane_form;
}