You are here

public function RangeField::alterFieldFormatterMigration in Range 8

Apply any custom processing to the field formatter migration.

Parameters

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

Overrides FieldPluginBase::alterFieldFormatterMigration

File

src/Plugin/migrate/field/d6/RangeField.php, line 86

Class

RangeField
MigrateField Plugin for Drupal 6 range fields.

Namespace

Drupal\range\Plugin\migrate\field\d6

Code

public function alterFieldFormatterMigration(MigrationInterface $migration) {

  /** @var \Drupal\migrate\Row $row */
  $row = $migration
    ->getSourcePlugin()
    ->current();
  if ($this
    ->isRangeField($row
    ->getSourceProperty('type'))) {
    $process_type = [];
    $process_type[0]['map']['range_decimal'] = $process_type[0]['map']['range_float'] = [
      'default' => 'range_decimal',
      'us_0' => 'range_decimal',
      'us_1' => 'range_decimal',
      'us_2' => 'range_decimal',
      'be_0' => 'range_decimal',
      'be_1' => 'range_decimal',
      'be_2' => 'range_decimal',
      'fr_0' => 'range_decimal',
      'fr_1' => 'range_decimal',
      'fr_2' => 'range_decimal',
      'unformatted' => 'range_unformatted',
    ];
    $process_type[0]['map']['range_integer'] = [
      'default' => 'range_integer',
      'us_0' => 'range_integer',
      'be_0' => 'range_integer',
      'fr_0' => 'range_integer',
      'unformatted' => 'range_unformatted',
    ];
    $migration
      ->mergeProcessOfProperty('options/type', $process_type);
    $process_settings = [
      'plugin' => 'd6_range_field_formatter_settings',
    ];
    $migration
      ->mergeProcessOfProperty('options/settings', $process_settings);
  }
}