You are here

public function PaymentMethodEditForm::buildForm in Commerce Core 8.2

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

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

Return value

array The form structure.

Overrides EntityForm::buildForm

File

modules/payment/src/Form/PaymentMethodEditForm.php, line 45

Class

PaymentMethodEditForm
Provides the payment method edit form.

Namespace

Drupal\commerce_payment\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $inline_form = $this->inlineFormManager
    ->createInstance('payment_gateway_form', [
    'operation' => 'edit-payment-method',
  ], $this->entity);
  $form['payment_method'] = [
    '#parents' => [
      'payment_method',
    ],
    '#inline_form' => $inline_form,
  ];
  $form['payment_method'] = $inline_form
    ->buildInlineForm($form['payment_method'], $form_state);
  $form['actions'] = $this
    ->actionsElement($form, $form_state);
  return $form;
}