You are here

public function MigrationPluginManager::createStubMigration in Drupal 10

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

Creates a stub migration plugin from a definition array.

Parameters

array $definition: The migration definition. If an 'id' key is set then this will be used as the migration ID, if not a random ID will be assigned.

Return value

\Drupal\migrate\Plugin\Migration The stub migration.

Overrides MigrationPluginManagerInterface::createStubMigration

File

core/modules/migrate/src/Plugin/MigrationPluginManager.php, line 239

Class

MigrationPluginManager
Plugin manager for migration plugins.

Namespace

Drupal\migrate\Plugin

Code

public function createStubMigration(array $definition) {
  $id = $definition['id'] ?? uniqid();
  return Migration::create(\Drupal::getContainer(), [], $id, $definition);
}