You are here

public static function MigrationDeriverTrait::getSourcePlugin in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/src/Plugin/MigrationDeriverTrait.php \Drupal\migrate\Plugin\MigrationDeriverTrait::getSourcePlugin()
  2. 9 core/modules/migrate/src/Plugin/MigrationDeriverTrait.php \Drupal\migrate\Plugin\MigrationDeriverTrait::getSourcePlugin()

Returns a fully initialized instance of a source plugin.

Parameters

string $source_plugin_id: The source plugin ID.

Return value

\Drupal\migrate\Plugin\MigrateSourceInterface|\Drupal\migrate\Plugin\RequirementsInterface The fully initialized source plugin.

File

core/modules/migrate/src/Plugin/MigrationDeriverTrait.php, line 19

Class

MigrationDeriverTrait
Provides functionality for migration derivers.

Namespace

Drupal\migrate\Plugin

Code

public static function getSourcePlugin($source_plugin_id) {
  $definition = [
    'source' => [
      'ignore_map' => TRUE,
      'plugin' => $source_plugin_id,
    ],
    'destination' => [
      'plugin' => 'null',
    ],
    'idMap' => [
      'plugin' => 'null',
    ],
  ];
  return \Drupal::service('plugin.manager.migration')
    ->createStubMigration($definition)
    ->getSourcePlugin();
}