You are here

public function RevisionOverviewForm::submitForm in Support Ticketing System 8

Form submission 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 FormInterface::submitForm

File

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

Class

RevisionOverviewForm
Provides a form for revision overview page.

Namespace

Drupal\support_ticket\Form

Code

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

  // Always place the older revision on the left side of the comparison
  // and the newer revision on the right side (however revisions can be
  // compared both ways if we manually change the order of the parameters).
  if ($vid_left > $vid_right) {
    $aux = $vid_left;
    $vid_left = $vid_right;
    $vid_right = $aux;
  }

  // Builds the redirect Url.
  $redirect_url = Url::fromRoute('support_ticket.revisions_diff', array(
    'support_ticket' => $stid,
    'left_vid' => $vid_left,
    'right_vid' => $vid_right,
  ));
  $form_state
    ->setRedirectUrl($redirect_url);
}