function FieldTypeDefaults::transform

Overrides ProcessPluginBase::transform

File

core/modules/field/src/Plugin/migrate/process/d6/FieldTypeDefaults.php, line 22

Class

FieldTypeDefaults
Gives us a chance to set per field defaults.

Namespace

Drupal\field\Plugin\migrate\process\d6

Code

public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
  if (is_array($value)) {
    if ($row->getSourceProperty('module') == 'date') {
      $value = 'datetime_default';
    }
    else {
      throw new MigrateException(sprintf('Failed to lookup field type %s in the static map.', var_export($value, TRUE)));
    }
  }
  return $value;
}

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