diff --git a/modules/feeds_migrate_ui/src/Form/MigrationForm.php b/modules/feeds_migrate_ui/src/Form/MigrationForm.php index 11d2255478f4198abf804206385b9495638b38c3..c46f95d6ac299b095a655ff6c2ef9a33dc6d9fca 100644 --- a/modules/feeds_migrate_ui/src/Form/MigrationForm.php +++ b/modules/feeds_migrate_ui/src/Form/MigrationForm.php @@ -9,6 +9,7 @@ use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\SubformState; use Drupal\Core\Render\Renderer; +use Drupal\Core\Url; use Drupal\feeds_migrate\Plugin\MigrateFormPluginFactory; use Drupal\migrate\Plugin\MigratePluginManagerInterface; use Drupal\migrate\Plugin\MigrationPluginManagerInterface; @@ -149,11 +150,26 @@ class MigrationForm extends EntityForm { */ protected function actions(array $form, FormStateInterface $form_state) { $actions = parent::actions($form, $form_state); - $actions['submit']['#value'] = $this->t('Save'); + + if ($this->entity->isNew()) { + $actions['submit']['#value'] = $this->t('Save and add mappings'); + $actions['submit']['#submit'][] = '::toMapping'; + } + else { + $actions['submit']['#value'] = $this->t('Save'); + } return $actions; } + /** + * Redirects to mappings when the user saves a new migration. + */ + public function toMapping(array &$form, FormStateInterface $form_state) { + $migration = $form['id']['#value']; + $form_state->setRedirectUrl(Url::fromRoute('entity.migration.mapping.list', ['migration' => $migration])); + } + /** * {@inheritdoc} */