You are here

public function ConfirmClearForm::submitForm in Queue UI 8.2

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/ConfirmClearForm.php, line 95

Class

ConfirmClearForm
Class ConfirmClearForm @package Drupal\queue_ui\Form

Namespace

Drupal\queue_ui\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $queues = $this->tempStoreFactory
    ->get('queue_ui_clear_queues')
    ->get($this
    ->currentUser()
    ->id());
  foreach ($queues as $name) {
    $queue = \Drupal::queue($name);
    $queue
      ->deleteQueue();
  }
  $this->messenger
    ->addMessage($this
    ->formatPlural(count($queues), 'Queue deleted', '@count queues cleared'));
  $form_state
    ->setRedirect('queue_ui.overview_form');
}