You are here

class FieldMigration in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate_drupal/src/Plugin/migrate/FieldMigration.php \Drupal\migrate_drupal\Plugin\migrate\FieldMigration
  2. 9 core/modules/migrate_drupal/src/Plugin/migrate/FieldMigration.php \Drupal\migrate_drupal\Plugin\migrate\FieldMigration

Migration plugin class for migrations dealing with field config and values.

Hierarchy

Expanded class hierarchy of FieldMigration

2 files declare their use of FieldMigration
D7Comment.php in core/modules/comment/src/Plugin/migrate/D7Comment.php
User.php in core/modules/user/src/Plugin/migrate/User.php
9 string references to 'FieldMigration'
d6_field.yml in core/modules/field/migrations/d6_field.yml
core/modules/field/migrations/d6_field.yml
d6_field_formatter_settings.yml in core/modules/field/migrations/d6_field_formatter_settings.yml
core/modules/field/migrations/d6_field_formatter_settings.yml
d6_field_instance.yml in core/modules/field/migrations/d6_field_instance.yml
core/modules/field/migrations/d6_field_instance.yml
d6_field_instance_widget_settings.yml in core/modules/field/migrations/d6_field_instance_widget_settings.yml
core/modules/field/migrations/d6_field_instance_widget_settings.yml
d7_field.yml in core/modules/field/migrations/d7_field.yml
core/modules/field/migrations/d7_field.yml

... See full list

File

core/modules/migrate_drupal/src/Plugin/migrate/FieldMigration.php, line 16

Namespace

Drupal\migrate_drupal\Plugin\migrate
View source
class FieldMigration extends Migration implements ContainerFactoryPluginInterface {

  /**
   * Flag indicating whether the field data has been filled already.
   *
   * @var bool
   */
  protected $init = FALSE;

  /**
   * The migration field discovery service.
   *
   * @var \Drupal\migrate_drupal\FieldDiscoveryInterface
   */
  protected $fieldDiscovery;

  /**
   * Constructs a FieldMigration.
   *
   * @param array $configuration
   *   Plugin configuration.
   * @param string $plugin_id
   *   The plugin ID.
   * @param mixed $plugin_definition
   *   The plugin definition.
   * @param \Drupal\migrate\Plugin\MigrationPluginManagerInterface $migration_plugin_manager
   *   The migration plugin manager.
   * @param \Drupal\migrate\Plugin\MigratePluginManager $source_plugin_manager
   *   The source migration plugin manager.
   * @param \Drupal\migrate\Plugin\MigratePluginManager $process_plugin_manager
   *   The process migration plugin manager.
   * @param \Drupal\migrate\Plugin\MigrateDestinationPluginManager $destination_plugin_manager
   *   The destination migration plugin manager.
   * @param \Drupal\migrate\Plugin\MigratePluginManager $id_map_plugin_manager
   *   The ID map migration plugin manager.
   * @param \Drupal\migrate_drupal\FieldDiscoveryInterface $field_discovery
   *   The migration field discovery service.
   */
  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 $id_map_plugin_manager, FieldDiscoveryInterface $field_discovery) {
    parent::__construct($configuration, $plugin_id, $plugin_definition, $migration_plugin_manager, $source_plugin_manager, $process_plugin_manager, $destination_plugin_manager, $id_map_plugin_manager);
    $this->fieldDiscovery = $field_discovery;
  }

  /**
   * {@inheritdoc}
   */
  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'));
  }

  /**
   * {@inheritdoc}
   */
  public function getProcess() {
    if (!$this->init) {
      $this->init = TRUE;
      $this->fieldDiscovery
        ->addAllFieldProcesses($this);
    }
    return parent::getProcess();
  }

}

Members