You are here

public function FileEntity::defineValueProcessPipeline in Media Migration 8

Apply any custom processing to the field bundle migrations.

Parameters

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

string $field_name: The field name we're processing the value for.

array $data: The array of field data from FieldValues::fieldData().

Overrides FieldPluginBase::defineValueProcessPipeline

File

src/Plugin/migrate/field/FileEntity.php, line 59

Class

FileEntity
Field Plugin for file_entity to media migrations.

Namespace

Drupal\media_migration\Plugin\migrate\field

Code

public function defineValueProcessPipeline(MigrationInterface $migration, $field_name, $data) {

  // The "media_migration_delta_sort" plugin sorts field values for PostgreSQL
  // sources.
  // @see \Drupal\media_migration\Plugin\migrate\process\MediaMigrationDeltaSort
  // @todo remove when https://drupal.org/i/3164520 is fixed.
  $process = [
    [
      'plugin' => 'media_migration_delta_sort',
      'source' => $field_name,
    ],
  ];
  $process[] = [
    'plugin' => 'sub_process',
    'process' => [
      'target_id' => 'fid',
    ],
  ];
  $migration
    ->setProcessOfProperty($field_name, $process);

  // Add the needed media migrations as required dependencies.
  $this
    ->addRequiredMediaMigrationDependencies($migration, $data);
}