You are here

public function SupportTicketForm::submitForm in Support Ticketing System 8

Updates the support_ticket object by processing the submitted values.

This function can be called by a "Next" button of a wizard to update the form state's entity with the current step's values before proceeding to the next step.

Overrides ContentEntityForm::submitForm

File

modules/support_ticket/src/SupportTicketForm.php, line 313
Contains \Drupal\support_ticket\SupportTicketForm.

Class

SupportTicketForm
Form controller for the support ticket edit forms.

Namespace

Drupal\support_ticket

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Build the support_ticket object from the submitted values.
  parent::submitForm($form, $form_state);
  $support_ticket = $this->entity;

  // Save as a new revision if requested to do so.
  if (!$form_state
    ->isValueEmpty('revision') && $form_state
    ->getValue('revision') != FALSE) {
    $support_ticket
      ->setNewRevision();

    // If a new revision is created, save the current user as revision author.
    $support_ticket
      ->setRevisionCreationTime(REQUEST_TIME);
    $support_ticket
      ->setRevisionAuthorId(\Drupal::currentUser()
      ->id());
  }
  else {
    $support_ticket
      ->setNewRevision(FALSE);
  }
}