public function SourceCsvForm::cancel in Migrate Tools 8.4
Form submission handler for the 'cancel' action.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
File
- src/
Form/ SourceCsvForm.php, line 344
Class
- SourceCsvForm
- Provides an edit form for CSV source plugin column_names configuration.
Namespace
Drupal\migrate_tools\FormCode
public function cancel(array $form, FormStateInterface $form_state) {
// Restore the file columns to the original settings.
$this->file
->setColumnNames($this->sourceConfiguration['original']);
// Remove this migration from the store.
try {
$this->store
->delete($this->id);
} catch (TempStoreException $e) {
$this->messenger
->addError($e
->getMessage());
}
$migrationsChanged = $this->store
->get('migrations_changed');
unset($migrationsChanged[$this->id]);
try {
$this->store
->set('migrations_changed', $migrationsChanged);
} catch (TempStoreException $e) {
$this->messenger
->addError($e
->getMessage());
}
$form_state
->setRedirect('entity.migration_group.list');
}