You are here

function drush_migrate_tools_migrate_fields_source in Migrate Tools 8.3

Same name and namespace in other branches
  1. 8 migrate_tools.drush.inc \drush_migrate_tools_migrate_fields_source()
  2. 8.2 migrate_tools.drush.inc \drush_migrate_tools_migrate_fields_source()
  3. 8.4 migrate_tools.drush.inc \drush_migrate_tools_migrate_fields_source()

Parameters

string $migration_id:

File

./migrate_tools.drush.inc, line 421
Command-line tools to aid performing and developing migrations.

Code

function drush_migrate_tools_migrate_fields_source($migration_id) {

  /** @var MigrationInterface $migration */
  $migration = \Drupal::service('plugin.manager.migration')
    ->createInstance($migration_id);
  if ($migration) {
    $source = $migration
      ->getSourcePlugin();
    $table = [];
    foreach ($source
      ->fields() as $machine_name => $description) {
      $table[] = [
        strip_tags($description),
        $machine_name,
      ];
    }
    drush_print_table($table);
  }
  else {
    drush_log(dt('Migration @id does not exist', [
      '@id' => $migration_id,
    ]), 'error');
  }
}