public function ConfirmationForm::submitForm in Auto Purge Users 8.2
Same name and namespace in other branches
- 8.3 src/Form/ConfirmationForm.php \Drupal\purge_users\Form\ConfirmationForm::submitForm()
- 8 src/Form/ConfirmationForm.php \Drupal\purge_users\Form\ConfirmationForm::submitForm()
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/ ConfirmationForm.php, line 104
Class
- ConfirmationForm
- Class ConfirmationForm.
Namespace
Drupal\purge_users\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$ids = purge_users_get_user_ids();
// Initialize a batch operation.
$batch = [
'operations' => [],
'finished' => 'purge_users_batch_completed',
'title' => $this
->t('Delete users'),
'init_message' => $this
->t('Delete users operation is starting...'),
'progress_message' => $this
->t('Processed @current out of @total.'),
'error_message' => $this
->t('Delete users operation has encountered an error.'),
];
// User load multiple to process through batch operation.
foreach ($ids as $id) {
$batch['operations'][] = [
'\\Drupal\\purge_users\\Plugin\\BatchWorker\\BatchWorker::batchWorkerPurgeUsers',
[
$id,
],
];
}
// Batch set.
batch_set($batch);
}