You are here

public function AgreeTerms::validatePaneForm in Commerce Agree Terms 8

Validates the pane form.

Parameters

array $pane_form: The pane form.

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

array $complete_form: The complete form structure.

Overrides CheckoutPaneBase::validatePaneForm

File

src/Plugin/Commerce/CheckoutPane/AgreeTerms.php, line 170

Class

AgreeTerms
Provides the completion message pane.

Namespace

Drupal\commerce_agree_terms\Plugin\Commerce\CheckoutPane

Code

public function validatePaneForm(array &$pane_form, FormStateInterface $form_state, array &$complete_form) {
  $values = $form_state
    ->getValue($pane_form['#parents']);
  if (!$values['terms_and_conditions']) {
    $form_state
      ->setError($pane_form, $this->configuration['invalid_text']);
  }
}