You are here

public static function PrepareModulesEntityUninstallForm::moduleBatchFinished in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/src/Form/PrepareModulesEntityUninstallForm.php \Drupal\system\Form\PrepareModulesEntityUninstallForm::moduleBatchFinished()

Implements callback_batch_finished().

Finishes the module batch, redirect to the uninstall page and output the successful data deletion message.

File

core/modules/system/src/Form/PrepareModulesEntityUninstallForm.php, line 249

Class

PrepareModulesEntityUninstallForm
Provides a form removing module content entities data before uninstallation.

Namespace

Drupal\system\Form

Code

public static function moduleBatchFinished($success, $results, $operations) {
  $entity_type_plural = \Drupal::entityTypeManager()
    ->getDefinition($results['entity_type_id'])
    ->getPluralLabel();
  \Drupal::messenger()
    ->addStatus(new TranslatableMarkup('All @entity_type_plural have been deleted.', [
    '@entity_type_plural' => $entity_type_plural,
  ]));
  return new RedirectResponse(Url::fromRoute('system.modules_uninstall')
    ->setAbsolute()
    ->toString());
}