You are here

function drush_migrate_fields_source in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 migrate.drush.inc \drush_migrate_fields_source()

File

./migrate.drush.inc, line 445
Drush support for the migrate module

Code

function drush_migrate_fields_source($args = NULL) {
  try {
    $migrations = drush_migrate_get_migrations($args);
    foreach ($migrations as $name => $migration) {
      drush_print("\n" . dt('@migration Source Fields', array(
        '@migration' => $name,
      )) . "\n");
      $source = $migration
        ->getSource();
      if (method_exists($source, 'fields')) {
        $table = array();
        foreach ($source
          ->fields() as $machine_name => $description) {
          $table[] = array(
            strip_tags($description),
            $machine_name,
          );
        }
        drush_print_table($table);
      }
      else {
        drush_print(dt('No fields were found.'));
      }
    }
  } catch (MigrateException $e) {
    drush_print($e
      ->getMessage());
    exit;
  }
}