You are here

public function ConfirmClearReplicationQueueForm::submitForm in Workspace 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/ConfirmClearReplicationQueueForm.php, line 50

Class

ConfirmClearReplicationQueueForm
Class ConfirmClearReplicationQueueForm.

Namespace

Drupal\workspace\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  if ($this
    ->clearReplicationQueue()) {
    $message = $this
      ->t('All the queued deployments have been marked as failed and have been removed from the replication queue.');
  }
  else {
    $message = $this
      ->t('There were not any queued deployments in the replication queue.');
  }
  $form_state
    ->setRedirectUrl($this
    ->getCancelUrl());
  $this
    ->messenger()
    ->addMessage($message);
}