You are here

public function FieldPluginBase::alterFieldFormatterMigration in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate_drupal/src/Plugin/migrate/field/FieldPluginBase.php \Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase::alterFieldFormatterMigration()
  2. 10 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

1 call to FieldPluginBase::alterFieldFormatterMigration()
FieldPluginBase::processFieldFormatter in core/modules/migrate_drupal/src/Plugin/migrate/field/FieldPluginBase.php
Alter field formatter migration.

File

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

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);
}