function FieldType::transform

Same name and namespace in other branches
  1. 9 core/modules/field/src/Plugin/migrate/process/FieldType.php \Drupal\field\Plugin\migrate\process\FieldType::transform()
  2. 8.9.x core/modules/field/src/Plugin/migrate/process/FieldType.php \Drupal\field\Plugin\migrate\process\FieldType::transform()
  3. 11.x core/modules/field/src/Plugin/migrate/process/FieldType.php \Drupal\field\Plugin\migrate\process\FieldType::transform()

Overrides StaticMap::transform

File

core/modules/field/src/Plugin/migrate/process/FieldType.php, line 68

Class

FieldType
#[MigrateProcess('field_type')]

Namespace

Drupal\field\Plugin\migrate\process

Code

public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
  $field_type = is_array($value) ? $value[0] : $value;
  try {
    $plugin_id = $this->fieldPluginManager
      ->getPluginIdFromFieldType($field_type, [], $this->migration);
    return $this->fieldPluginManager
      ->createInstance($plugin_id, [], $this->migration)
      ->getFieldType($row);
  } catch (PluginNotFoundException $e) {
    return parent::transform($value, $migrate_executable, $row, $destination_property);
  }
}

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