You are here

public function MigrateUIWizard::addMigration in Migrate 7.2

Record all the information necessary to register a migration when this is all over.

Parameters

string $machine_name: Machine name for the migration class.

string $class_name: Name of the Migration class to instantiate.

array $arguments: Further information configuring the migration.

File

migrate_ui/migrate_ui.wizard.inc, line 520
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 addMigration($machine_name, $class_name, $arguments) {

  // Give extenders an opportunity to modify or reject this migration.
  foreach ($this->extenders as $extender) {
    if (!$extender
      ->addMigrationAlter($machine_name, $class_name, $arguments, $this)) {
      return FALSE;
    }
  }
  $machine_name = $this->groupName . $machine_name;
  if (isset($arguments['dependencies'])) {
    foreach ($arguments['dependencies'] as $index => $dependency) {
      $arguments['dependencies'][$index] = $this->groupName . $dependency;
    }
  }
  if (isset($arguments['soft_dependencies'])) {
    foreach ($arguments['soft_dependencies'] as $index => $dependency) {
      $arguments['soft_dependencies'][$index] = $this->groupName . $dependency;
    }
  }
  $arguments += array(
    'group_name' => $this->groupName,
    'machine_name' => $machine_name,
  );
  $this->migrations[$machine_name] = array(
    'class_name' => $class_name,
    'arguments' => $arguments,
  );
  return TRUE;
}