function FieldPluginBase::alterFieldFormatterMigration

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

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.