function PrepareModulesEntityUninstallForm::submitForm

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

Overrides FormInterface::submitForm

File

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

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 = [
        'title' => t('Deleting @entity_type_plural', [
            '@entity_type_plural' => $entity_type_plural,
        ]),
        'operations' => [
            [
                [
                    __CLASS__,
                    'deleteContentEntities',
                ],
                [
                    $entity_type_id,
                ],
            ],
        ],
        'finished' => [
            __CLASS__,
            'moduleBatchFinished',
        ],
        'progress_message' => '',
    ];
    batch_set($batch);
}

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