You are here

public static function MigrationPluginTool::getSourcePlugin in Media Migration 8

Creates a source plugin from a plugin ID or from a plugin configuration.

Parameters

string|array $source: The source plugin ID, or the configuration of the source plugin.

Return value

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

See also

\Drupal\migrate\Plugin\MigrationDeriverTrait

2 calls to MigrationPluginTool::getSourcePlugin()
MigratePluginAlterer::addMediaWysiwygProcessor in src/MigratePluginAlterer.php
Appends text processors to transform D7 tokens to embeds.
MigratePluginAlterer::alterFieldMigrations in src/MigratePluginAlterer.php
Alters field migrations from file_entity/media in 7 to media in 8.

File

src/Utility/MigrationPluginTool.php, line 25

Class

MigrationPluginTool
Utility for filtering and manipulating migration plugin definitions.

Namespace

Drupal\media_migration\Utility

Code

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