Skip to content
Snippets Groups Projects
Commit df507622 authored by Iyyappan Matheri Govindasamy's avatar Iyyappan Matheri Govindasamy Committed by Youri van Koppen
Browse files

Issue #3063092 by MegaChriz, bruno.bicudo, iyyappan.govind: Added "Save and...

Issue #3063092 by MegaChriz, bruno.bicudo, iyyappan.govind: Added "Save and add mapping" button on Migration creation page.
parent ea1b72d9
Branches
No related tags found
No related merge requests found
......@@ -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}
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment