View source
<?php
namespace Drupal\migrate_drupal\Plugin\migrate;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\migrate\Plugin\MigrateDestinationPluginManager;
use Drupal\migrate\Plugin\MigratePluginManager;
use Drupal\migrate\Plugin\Migration;
use Drupal\migrate\Plugin\MigrationPluginManagerInterface;
use Drupal\migrate_drupal\FieldDiscoveryInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class FieldMigration extends Migration implements ContainerFactoryPluginInterface {
protected $init = FALSE;
protected $fieldDiscovery;
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationPluginManagerInterface $migration_plugin_manager, MigratePluginManager $source_plugin_manager, MigratePluginManager $process_plugin_manager, MigrateDestinationPluginManager $destination_plugin_manager, MigratePluginManager $idmap_plugin_manager, FieldDiscoveryInterface $field_discovery) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration_plugin_manager, $source_plugin_manager, $process_plugin_manager, $destination_plugin_manager, $idmap_plugin_manager);
$this->fieldDiscovery = $field_discovery;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('plugin.manager.migration'), $container
->get('plugin.manager.migrate.source'), $container
->get('plugin.manager.migrate.process'), $container
->get('plugin.manager.migrate.destination'), $container
->get('plugin.manager.migrate.id_map'), $container
->get('migrate_drupal.field_discovery'));
}
public function getProcess() {
if (!$this->init) {
$this->init = TRUE;
$this->fieldDiscovery
->addAllFieldProcesses($this);
}
return parent::getProcess();
}
}