You are here

public function FieldPluginBase::alterFieldFormatterMigration in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate_drupal/src/Plugin/migrate/field/FieldPluginBase.php \Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase::alterFieldFormatterMigration()
  2. 9 core/modules/migrate_drupal/src/Plugin/migrate/field/FieldPluginBase.php \Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase::alterFieldFormatterMigration()

Apply any custom processing to the field formatter migration.

Parameters

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

Overrides MigrateFieldInterface::alterFieldFormatterMigration

File

core/modules/migrate_drupal/src/Plugin/migrate/field/FieldPluginBase.php, line 82

Class

FieldPluginBase
The base class for all field plugins.

Namespace

Drupal\migrate_drupal\Plugin\migrate\field

Code

public function alterFieldFormatterMigration(MigrationInterface $migration) {
  $process = [];

  // Some migrate field plugin IDs are prefixed with 'd6_' or 'd7_'. Since the
  // plugin ID is used in the static map as the module name, we have to remove
  // this prefix from the plugin ID.
  $plugin_id = preg_replace('/d[67]_/', '', $this->pluginId);
  foreach ($this
    ->getFieldFormatterMap() as $source_format => $destination_format) {
    $process[0]['map'][$plugin_id][$source_format] = $destination_format;
  }
  $migration
    ->mergeProcessOfProperty('options/type', $process);
}