By maxocub on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.4.x
Introduced in version:
8.4.0
Issue links:
Description:
Summary
- The base class for migrate filed plugins (\Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase) now implements the remaining two interface methods: getFieldFormatterMap() and processFieldValues().
- If no custom code is needed in those methods, classes that are extending this base class can now leave the class body empty and only use the type_map annotation to map the field types.
Before
/**
* @MigrateField(
* id = "number_default",
* type_map = {
* "number_integer" = "integer",
* "number_decimal" = "decimal",
* "number_float" = "float",
* },
* core = {7}
* )
*/
class NumberField extends FieldPluginBase {
/**
* {@inheritdoc}
*/
public function getFieldFormatterMap() {
return [];
}
/**
* {@inheritdoc}
*/
public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
$process = [
'plugin' => 'get',
'source' => $field_name,
];
$migration->mergeProcessOfProperty($field_name, $process);
}
}
After
/**
* @MigrateField(
* id = "number_default",
* type_map = {
* "number_integer" = "integer",
* "number_decimal" = "decimal",
* "number_float" = "float",
* },
* core = {7}
* )
*/
class NumberField extends FieldPluginBase {}
Impacts:
Module developers