You are here

public function RevisionOverviewForm::validateForm in Support Ticketing System 8

Form validation handler.

Parameters

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

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

Overrides FormBase::validateForm

File

modules/support_ticket/src/Form/RevisionOverviewForm.php, line 286
Contains \Drupal\support_ticket\Form\RevisionOverviewForm

Class

RevisionOverviewForm
Provides a form for revision overview page.

Namespace

Drupal\support_ticket\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $input = $form_state
    ->getUserInput();
  $vid_left = $input['radios_left'];
  $vid_right = $input['radios_right'];
  if ($vid_left == $vid_right || !$vid_left || !$vid_right) {

    // @todo Radio-boxes selection resets if there are errors.
    $form_state
      ->setErrorByName('support_ticket_revisions_table', $this
      ->t('Select different revisions to compare.'));
  }
}