You are here

public function AdminUninstallForm::submitForm in Private Message 8.2

Same name and namespace in other branches
  1. 8 src/Form/AdminUninstallForm.php \Drupal\private_message\Form\AdminUninstallForm::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/AdminUninstallForm.php, line 96

Class

AdminUninstallForm
Defines the admin uninstall form for the Private Message module.

Namespace

Drupal\private_message\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $batch = [
    'title' => $this
      ->t('Deleting private message data'),
    'operations' => [
      [
        [
          __CLASS__,
          'deletePrivateMessageAccessTimes',
        ],
        [],
      ],
      [
        [
          __CLASS__,
          'deletePrivateMessageDeleteTimes',
        ],
        [],
      ],
      [
        [
          __CLASS__,
          'deletePrivateMessageMessages',
        ],
        [],
      ],
      [
        [
          __CLASS__,
          'deletePrivateMessageThreads',
        ],
        [],
      ],
    ],
    'progress_message' => static::t('Deleting private message data. Completed: @percentage% (@current of @total).'),
  ];
  batch_set($batch);
  $this->messenger
    ->addMessage($this
    ->t('Private message data has been deleted.'));
}