By mikeryan on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.2.x
Introduced in version:
8.2.2
Issue links:
Description:
The d6_cck_file process plugin processes Drupal 6 file fields into Drupal 8 file entity reference fields, in part by translating the Drupal 6 file ID (fid) into the equivalent Drupal 8 fid. Through Drupal 8.2.1, the ID of the file migration used to translate the fid, 'd6_file', was hardcoded in the process plugin - if implementing a custom Drupal 6 migration process with a different ID for the file migration, you would need to write a custom process plugin extending d6_cck_file to properly map the IDs. With Drupal 8.2.2, you can simply provide a 'migration' option pointing to your custom file migration.
Previously:
my_node_migration.yml:
...
process:
...
field_image:
plugin: my_cck_file
source: field_image
...
MyCckFile.php:
namespace Drupal\my_migrate_module\Plugin\migrate\process;
use Drupal\file\Plugin\migrate\process\d6\CckFile;
use Drupal\migrate\Plugin\MigrationInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* @MigrateProcessPlugin(
* id = "my_cck_file"
* )
*/
class MyCckFile extends CckFile {
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
$migration_plugin_configuration = [
'source' => ['fid'],
'migration' => 'my_file_migration',
];
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$migration,
$container->get('plugin.manager.migrate.process')->createInstance('migration', $migration_plugin_configuration, $migration)
);
}
}
Now:
...
process:
...
field_image:
plugin: d6_cck_file
source: field_image
migration: my_file_migration
...
Impacts:
Module developers