You are here

trait MigrationDeriverTrait in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/src/Plugin/MigrationDeriverTrait.php \Drupal\migrate\Plugin\MigrationDeriverTrait

Provides functionality for migration derivers.

Hierarchy

4 files declare their use of MigrationDeriverTrait
D6NodeDeriver.php in core/modules/node/src/Plugin/migrate/D6NodeDeriver.php
D6TermNodeDeriver.php in core/modules/taxonomy/src/Plugin/migrate/D6TermNodeDeriver.php
D7NodeDeriver.php in core/modules/node/src/Plugin/migrate/D7NodeDeriver.php
D7TaxonomyTermDeriver.php in core/modules/taxonomy/src/Plugin/migrate/D7TaxonomyTermDeriver.php

File

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

Namespace

Drupal\migrate\Plugin
View source
trait MigrationDeriverTrait {

  /**
   * Returns a fully initialized instance of a source plugin.
   *
   * @param string $source_plugin_id
   *   The source plugin ID.
   *
   * @return \Drupal\migrate\Plugin\MigrateSourceInterface|\Drupal\migrate\Plugin\RequirementsInterface
   *   The fully initialized source plugin.
   */
  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();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MigrationDeriverTrait::getSourcePlugin public static function Returns a fully initialized instance of a source plugin.