public function JobAbortForm::submitForm

File

src/Form/JobAbortForm.php, line 37

Class

JobAbortForm
Provides a form for deleting a node.

Namespace

Drupal\tmgmt\Form

Code

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

  /** @var \Drupal\tmgmt\Entity\Job $entity */
  $entity = $this->entity;

  // It would make more sense to not display the button for the action,
  // however we do not know if the translator is able to abort a job until
  // we trigger the action.
  if ($entity
    ->abortTranslation()) {
    $entity
      ->addMessage('The user ordered aborting the Job through the UI.');
  }
  tmgmt_write_request_messages($entity);
  $form_state
    ->setRedirectUrl($this->entity
    ->toUrl());
}