function PrepareModulesEntityUninstallForm::moduleBatchFinished

Same name and namespace in other branches
  1. 9 core/modules/system/src/Form/PrepareModulesEntityUninstallForm.php \Drupal\system\Form\PrepareModulesEntityUninstallForm::moduleBatchFinished()
  2. 8.9.x core/modules/system/src/Form/PrepareModulesEntityUninstallForm.php \Drupal\system\Form\PrepareModulesEntityUninstallForm::moduleBatchFinished()
  3. 11.x 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 281

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());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.