You are here

ReviewForm.php in Drupal-to-Drupal data migration 8.3

File

migrate_d2d_ui/src/Form/ReviewForm.php
View source
<?php

namespace Drupal\migrate_d2d_ui\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

/**
 * Simple wizard step form.
 */
class ReviewForm extends FormBase {

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'migrate_d2d_review_form';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    dpm($form_state
      ->getTemporaryValue('wizard'));

    // @todo: Display details of the configuration.
    // @link: https://www.drupal.org/node/2742289
    $form['description'] = [
      '#markup' => $this
        ->t('Please review your migration configuration. When you submit this form, migration processes will be created and you will be left at the migration dashboard.'),
    ];

    // @todo: Derive default values from blog title.
    // @link https://www.drupal.org/node/2742287
    $form['group_id'] = [
      '#type' => 'machine_name',
      '#max_length' => 64,
      '#title' => t('ID to assign to the generated migration group'),
      '#default_value' => 'my_drupal',
    ];
    $form['prefix'] = [
      '#type' => 'machine_name',
      '#max_length' => 64 - strlen('drupal_content_page'),
      '#title' => t('ID to prepend to each generated migration'),
      '#default_value' => 'my_',
    ];
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $cached_values = $form_state
      ->getTemporaryValue('wizard');
    $cached_values['group_id'] = $form_state
      ->getValue('group_id');
    $cached_values['prefix'] = $form_state
      ->getValue('prefix');
    $form_state
      ->setTemporaryValue('wizard', $cached_values);
  }

}

Classes

Namesort descending Description
ReviewForm Simple wizard step form.