You are here

public function Image::alterMediaEntityMigrationDefinition in Media Migration 8

Same name in this branch
  1. 8 src/Plugin/media_migration/file_entity/Image.php \Drupal\media_migration\Plugin\media_migration\file_entity\Image::alterMediaEntityMigrationDefinition()
  2. 8 src/Plugin/media_migration/file/Image.php \Drupal\media_migration\Plugin\media_migration\file\Image::alterMediaEntityMigrationDefinition()

Alters the definition of the media entity migration.

Parameters

mixed[] $migration_definition: The migration definition of the current derived media entity migration.

\Drupal\Core\Database\Connection $connection: The database connection of the source Drupal 7 instance.

Overrides FileDealerBase::alterMediaEntityMigrationDefinition

File

src/Plugin/media_migration/file/Image.php, line 24

Class

Image
Plugin for images.

Namespace

Drupal\media_migration\Plugin\media_migration\file

Code

public function alterMediaEntityMigrationDefinition(array &$migration_definition, Connection $connection) : void {
  parent::alterMediaEntityMigrationDefinition($migration_definition, $connection);
  $source_field_name = $this
    ->getDestinationMediaSourceFieldName();
  $alt_property_process_pipeline = [
    'plugin' => 'null_coalesce',
    'source' => [
      'alt',
      'description',
    ],
  ];
  $migration_definition['process'][$source_field_name . '/alt'] = $alt_property_process_pipeline;
  $migration_definition['process'][$source_field_name . '/title'] = 'title';
  $migration_definition['process'][$source_field_name . '/width'] = 'width';
  $migration_definition['process'][$source_field_name . '/height'] = 'height';
  $migration_definition['process']['thumbnail/target_id'] = 'fid';
  $migration_definition['process']['thumbnail/alt'] = $alt_property_process_pipeline;
  $migration_definition['process']['thumbnail/title'] = 'title';
  $migration_definition['process']['thumbnail/width'] = 'width';
  $migration_definition['process']['thumbnail/height'] = 'height';
}