You are here

function _migrate_ui_selected_migrations in Migrate 7.2

Determine what migrations are selected (whether directly on a group page, or via group selections on the dashboard).

Parameters

$values:

Return value

array

2 calls to _migrate_ui_selected_migrations()
migrate_ui_migrate_submit in migrate_ui/migrate_ui.pages.inc
Submit callback for the dashboard form.
migrate_ui_migrate_validate in migrate_ui/migrate_ui.pages.inc
Validate callback for the dashboard form.

File

migrate_ui/migrate_ui.pages.inc, line 385
Pages for managing migration processes.

Code

function _migrate_ui_selected_migrations($values) {
  if (isset($values['migrations'])) {

    // From the specific group page, just take them in order (they were already
    // sorted by dependencies).
    $machine_names = array_filter($values['migrations']);
  }
  else {

    // From the groups page, we need to use migrate_migrations to be sure we've
    // got the tasks for each group in dependency order.
    $tasks = array_filter($values['tasks']);
    $migrations = migrate_migrations();
    $machine_names = array();
    foreach ($migrations as $migration) {
      $group_name = $migration
        ->getGroup()
        ->getName();
      if (in_array($group_name, $tasks)) {
        $machine_names[] = $migration
          ->getMachineName();
      }
    }
  }
  return $machine_names;
}