MigrationDeriverTrait.php

Same filename in other branches
  1. 9 core/modules/migrate/src/Plugin/MigrationDeriverTrait.php
  2. 8.9.x core/modules/migrate/src/Plugin/MigrationDeriverTrait.php
  3. 11.x core/modules/migrate/src/Plugin/MigrationDeriverTrait.php

Namespace

Drupal\migrate\Plugin

File

core/modules/migrate/src/Plugin/MigrationDeriverTrait.php

View source
<?php

namespace Drupal\migrate\Plugin;


/**
 * Provides functionality for migration derivers.
 */
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();
    }

}

Traits

Title Deprecated Summary
MigrationDeriverTrait Provides functionality for migration derivers.

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