You are here

public static function PaymentGatewayForm::preventSubmit in Commerce Core 8.2

Prevents the form from being submitted, by removing the actions element.

Done in a #process callback because buildInlineForm() doesn't have access to the complete form (since it's called while the initial form structure is still being built).

Parameters

array $element: The form element being processed.

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

array $complete_form: The complete form structure.

Return value

array The form element.

File

modules/payment/src/Plugin/Commerce/InlineForm/PaymentGatewayForm.php, line 141

Class

PaymentGatewayForm
Provides a form element for embedding payment gateway forms.

Namespace

Drupal\commerce_payment\Plugin\Commerce\InlineForm

Code

public static function preventSubmit(array &$element, FormStateInterface $form_state, array &$complete_form) {
  $complete_form['actions']['#access'] = FALSE;
  return $element;
}