You are here

public function PrepareModulesEntityUninstallForm::submitForm in Drupal 8

Same name and namespace in other branches
  1. 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 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);
}