public function MigrationConfirmationForm::buildForm in Lightning Workflow 8.2
Same name and namespace in other branches
- 8.3 modules/lightning_scheduler/src/Form/MigrationConfirmationForm.php \Drupal\lightning_scheduler\Form\MigrationConfirmationForm::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfirmFormBase::buildForm
File
- modules/
lightning_scheduler/ src/ Form/ MigrationConfirmationForm.php, line 77
Class
- MigrationConfirmationForm
- Provides a UI for migrating or purging scheduled transition data.
Namespace
Drupal\lightning_scheduler\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$entity_types = $this->migrator
->getEntityTypesToMigrate();
if (empty($entity_types)) {
$this
->messenger()
->addStatus($this
->t('Hey, nice! All migrations are completed.'));
return $form;
}
$form = parent::buildForm($form, $form_state);
$form['purge'] = [
'#type' => 'details',
'#collapsible' => TRUE,
'#title' => $this
->t('Purge without migrating'),
'#description' => $this
->t('Purging will allow you to discard existing scheduled transitions for a particular entity type without running the migration. This is useful if you don\'t have any scheduled transitions that you want to migrate. <strong>This will permanently delete scheduled transitions and cannot be undone.</strong>'),
'#tree' => TRUE,
'entity_type_id' => [
'#type' => 'select',
'#title' => $this
->t('Entity type to purge'),
'#options' => $this->migrator
->entityTypeOptions($entity_types),
],
'actions' => [
'#type' => 'actions',
'purge' => [
'#type' => 'submit',
'#value' => $this
->t('Purge'),
'#submit' => [
'::purge',
],
],
],
];
return $form;
}