function MigrationDeriverTrait::getSourcePlugin

Same name in other branches
  1. 9 core/modules/migrate/src/Plugin/MigrationDeriverTrait.php \Drupal\migrate\Plugin\MigrationDeriverTrait::getSourcePlugin()
  2. 8.9.x core/modules/migrate/src/Plugin/MigrationDeriverTrait.php \Drupal\migrate\Plugin\MigrationDeriverTrait::getSourcePlugin()
  3. 11.x 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.

4 calls to MigrationDeriverTrait::getSourcePlugin()
D6NodeDeriver::getDerivativeDefinitions in core/modules/node/src/Plugin/migrate/D6NodeDeriver.php
Gets the definition of all derivatives of a base plugin.
D6TermNodeDeriver::getDerivativeDefinitions in core/modules/taxonomy/src/Plugin/migrate/D6TermNodeDeriver.php
Gets the definition of all derivatives of a base plugin.
D7NodeDeriver::getDerivativeDefinitions in core/modules/node/src/Plugin/migrate/D7NodeDeriver.php
Gets the definition of all derivatives of a base plugin.
D7TaxonomyTermDeriver::getDerivativeDefinitions in core/modules/taxonomy/src/Plugin/migrate/D7TaxonomyTermDeriver.php
Gets the definition of all derivatives of a base 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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.