You are here

public function DeleteJob::submitForm in Advanced Queue 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

src/Form/DeleteJob.php, line 66

Class

DeleteJob
Provides a confirmation form for deleting a job.

Namespace

Drupal\advancedqueue\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $queue_backend = $this->queue
    ->getBackend();
  if ($queue_backend instanceof SupportsDeletingJobsInterface) {
    $queue_backend
      ->deleteJob($this->jobId);
  }
  $this
    ->messenger()
    ->addStatus($this
    ->t('Job @job_id has been deleted.', [
    '@job_id' => $this->jobId,
  ]));
  $form_state
    ->setRedirectUrl($this
    ->getCancelUrl());
}