public function PrepareUninstallForm::submitForm in Simplenews 8
Same name and namespace in other branches
- 8.2 src/Form/PrepareUninstallForm.php \Drupal\simplenews\Form\PrepareUninstallForm::submitForm()
 - 3.x src/Form/PrepareUninstallForm.php \Drupal\simplenews\Form\PrepareUninstallForm::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/ PrepareUninstallForm.php, line 41  
Class
- PrepareUninstallForm
 - Removes fields and data used by Simplenews.
 
Namespace
Drupal\simplenews\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
  $batch = [
    'title' => t('Deleting subscribers'),
    'operations' => [
      [
        [
          __CLASS__,
          'deleteSubscribers',
        ],
        [],
      ],
      [
        [
          __CLASS__,
          'removeFields',
        ],
        [],
      ],
      [
        [
          __CLASS__,
          'purgeFieldData',
        ],
        [],
      ],
    ],
    'progress_message' => static::t('Deleting Simplenews data... Completed @percentage% (@current of @total).'),
  ];
  batch_set($batch);
  $this
    ->messenger()
    ->addMessage($this
    ->t('Simplenews data has been deleted.'));
}