You are here

public function MigrationConfirmationForm::purge in Lightning Workflow 8.2

Same name and namespace in other branches
  1. 8.3 modules/lightning_scheduler/src/Form/MigrationConfirmationForm.php \Drupal\lightning_scheduler\Form\MigrationConfirmationForm::purge()

Submit function to handle purging 1.x base field data.

Parameters

array $form: The complete form.

\Drupal\Core\Form\FormStateInterface $form_state: The current form state.

File

modules/lightning_scheduler/src/Form/MigrationConfirmationForm.php, line 187

Class

MigrationConfirmationForm
Provides a UI for migrating or purging scheduled transition data.

Namespace

Drupal\lightning_scheduler\Form

Code

public function purge(array &$form, FormStateInterface $form_state) {
  $entity_type_id = $form_state
    ->getValue([
    'purge',
    'entity_type_id',
  ]);
  $this->migrator
    ->purge($entity_type_id, 'scheduled_publication');
  $this->migrator
    ->purge($entity_type_id, 'scheduled_moderation_state');
  $this->migrator
    ->completeMigration($entity_type_id);
  $message = $this
    ->t('Purged scheduled transitions for @entity_type.', [
    '@entity_type' => $form['purge']['entity_type_id']['#options'][$entity_type_id],
  ]);
  $this
    ->messenger()
    ->addStatus($message);
}