function PrepareModulesEntityUninstallForm::submitForm

Same name in other branches
  1. 9 core/modules/system/src/Form/PrepareModulesEntityUninstallForm.php \Drupal\system\Form\PrepareModulesEntityUninstallForm::submitForm()
  2. 8.9.x core/modules/system/src/Form/PrepareModulesEntityUninstallForm.php \Drupal\system\Form\PrepareModulesEntityUninstallForm::submitForm()
  3. 10 core/modules/system/src/Form/PrepareModulesEntityUninstallForm.php \Drupal\system\Form\PrepareModulesEntityUninstallForm::submitForm()

Overrides FormInterface::submitForm

File

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

Class

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

Namespace

Drupal\system\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    $entity_type_id = $form_state->getValue('entity_type_id');
    $entity_type_plural = $this->entityTypeManager
        ->getDefinition($entity_type_id)
        ->getPluralLabel();
    $batch_builder = (new BatchBuilder())->setTitle($this->t('Deleting @entity_type_plural', [
        '@entity_type_plural' => $entity_type_plural,
    ]))
        ->setProgressMessage('')
        ->setFinishCallback([
        __CLASS__,
        'moduleBatchFinished',
    ])
        ->addOperation([
        __CLASS__,
        'deleteContentEntities',
    ], [
        $entity_type_id,
    ]);
    batch_set($batch_builder->toArray());
}

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