You are here

public function ReferenceBase::alterFieldInstanceMigration in Drupal 9

Apply any custom processing to the field instance migration.

Parameters

\Drupal\migrate\Plugin\MigrationInterface $migration: The migration entity.

Overrides FieldPluginBase::alterFieldInstanceMigration

File

core/modules/migrate_drupal/src/Plugin/migrate/field/ReferenceBase.php, line 33

Class

ReferenceBase
Base class for Drupal reference fields.

Namespace

Drupal\migrate_drupal\Plugin\migrate\field

Code

public function alterFieldInstanceMigration(MigrationInterface $migration) {
  parent::alterFieldInstanceMigration($migration);

  // Add the reference migration as a required dependency to this migration.
  $migration_dependencies = $migration
    ->getMigrationDependencies();
  array_push($migration_dependencies['required'], $this
    ->getEntityTypeMigrationId());
  $migration_dependencies['required'] = array_unique($migration_dependencies['required']);
  $migration
    ->set('migration_dependencies', $migration_dependencies);
}