trait MigrationDeriverTrait

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

Title Sort descending Modifiers Object type Summary
MigrationDeriverTrait::getSourcePlugin public static function Returns a fully initialized instance of a source plugin.

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