You are here

public function MigrateUIWizard::formPerformImport in Migrate 7.2

Run the import process for the migration group we've defined.

File

migrate_ui/migrate_ui.wizard.inc, line 481
Migration wizard framework.

Class

MigrateUIWizard
The base class for migration wizards. Extend this class to implement a wizard UI for importing into Drupal from a given source format (Drupal, WordPress, etc.).

Code

public function formPerformImport() {
  $migrations = migrate_migrations();
  $operations = array();

  /** @var Migration $migration */
  foreach ($migrations as $migration) {
    $group_name = $migration
      ->getGroup()
      ->getName();
    if ($group_name == $this->groupName) {
      $operations[] = array(
        'migrate_ui_batch',
        array(
          'import',
          $migration
            ->getMachineName(),
          NULL,
          0,
        ),
      );
    }
  }
  if (count($operations) > 0) {
    $batch = array(
      'operations' => $operations,
      'title' => t('Import processing'),
      'file' => drupal_get_path('module', 'migrate_ui') . '/migrate_ui.pages.inc',
      'init_message' => t('Starting import process'),
      'progress_message' => t(''),
      'error_message' => t('An error occurred. Some or all of the import processing has failed.'),
      'finished' => 'migrate_ui_batch_finish',
    );
    batch_set($batch);
  }
}