You are here

public function FieldDiscovery::addEntityFieldProcesses in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/migrate_drupal/src/FieldDiscovery.php \Drupal\migrate_drupal\FieldDiscovery::addEntityFieldProcesses()
  2. 10 core/modules/migrate_drupal/src/FieldDiscovery.php \Drupal\migrate_drupal\FieldDiscovery::addEntityFieldProcesses()

Adds the field processes for an entity to a migration.

This method is used in field migrations to execute the migration process alter method specified by the 'field_plugin_method' key of the migration for all field plugins applicable to this Drupal to Drupal migration. This method is used internally for field, field instance, widget, and formatter migrations to allow field plugins to alter the process for these migrations.

Parameters

\Drupal\migrate\Plugin\MigrationInterface $migration: The migration to add processes to.

string $entity_type_id: The legacy entity type to add processes for.

Throws

\InvalidArgumentException

Overrides FieldDiscoveryInterface::addEntityFieldProcesses

1 call to FieldDiscovery::addEntityFieldProcesses()
FieldDiscovery::addAllFieldProcesses in core/modules/migrate_drupal/src/FieldDiscovery.php
Adds the field processes to a migration.

File

core/modules/migrate_drupal/src/FieldDiscovery.php, line 122

Class

FieldDiscovery
Provides field discovery for Drupal 6 & 7 migrations.

Namespace

Drupal\migrate_drupal

Code

public function addEntityFieldProcesses(MigrationInterface $migration, $entity_type_id) {
  $core = $this
    ->getCoreVersion($migration);
  $fields = $this
    ->getAllFields($core);
  if (!empty($fields[$entity_type_id]) && is_array($fields[$entity_type_id])) {
    foreach ($fields[$entity_type_id] as $bundle => $fields) {
      $this
        ->addBundleFieldProcesses($migration, $entity_type_id, $bundle);
    }
  }
}