function QueueExampleForm::submitDeleteQueue
Same name in other branches
- 8.x-1.x queue_example/src/Forms/QueueExampleForm.php \Drupal\queue_example\Forms\QueueExampleForm::submitDeleteQueue()
- 4.0.x modules/queue_example/src/Form/QueueExampleForm.php \Drupal\queue_example\Form\QueueExampleForm::submitDeleteQueue()
Submit handler for clearing/deleting the queue.
Parameters
array $form: Form definition array.
\Drupal\Core\Form\FormStateInterface $form_state: Form state object.
File
-
modules/
queue_example/ src/ Form/ QueueExampleForm.php, line 412
Class
- QueueExampleForm
- Form with examples on how to use queue.
Namespace
Drupal\queue_example\FormCode
public function submitDeleteQueue(array &$form, FormStateInterface $form_state) {
$queue = $this->queueFactory
->get($form_state->getValue('queue_name'));
$queue->deleteQueue();
$this->messenger()
->addMessage($this->t('Deleted the @queue_name queue and all items in it', [
'@queue_name' => $form_state->getValue('queue_name'),
]));
}