class FieldTypeDefaults
Same name in this branch
- 11.x core/modules/field/src/Plugin/migrate/process/d7/FieldTypeDefaults.php \Drupal\field\Plugin\migrate\process\d7\FieldTypeDefaults
Gives us a chance to set per field defaults.
Attributes
#[MigrateProcess('d6_field_type_defaults')]
Hierarchy
- class \Drupal\field\Plugin\migrate\process\d6\FieldTypeDefaults implements \Drupal\migrate\ProcessPluginBase
Expanded class hierarchy of FieldTypeDefaults
1 file declares its use of FieldTypeDefaults
- FieldTypeDefaultsTest.php in core/
modules/ field/ tests/ src/ Unit/ Plugin/ migrate/ process/ d6/ FieldTypeDefaultsTest.php
File
-
core/
modules/ field/ src/ Plugin/ migrate/ process/ d6/ FieldTypeDefaults.php, line 14
Namespace
Drupal\field\Plugin\migrate\process\d6View source
class FieldTypeDefaults extends ProcessPluginBase {
/**
* {@inheritdoc}
*/
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.