public function PrepareModulesEntityUninstallForm::submitForm in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/src/Form/PrepareModulesEntityUninstallForm.php \Drupal\system\Form\PrepareModulesEntityUninstallForm::submitForm()
- 9 core/modules/system/src/Form/PrepareModulesEntityUninstallForm.php \Drupal\system\Form\PrepareModulesEntityUninstallForm::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
- core/
modules/ system/ src/ Form/ PrepareModulesEntityUninstallForm.php, line 183
Class
- PrepareModulesEntityUninstallForm
- Provides a form removing module content entities data before uninstallation.
Namespace
Drupal\system\FormCode
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());
}