Node migration

Last updated on
30 April 2025

Node migrations are much like term migrations, in terms of mapping a source type to a destination type.

  • source_type: The unique machine name of the legacy node type.
  • destination_type: The unique machine name of the destination node type.
  • user_migration: The machine name of your user migration, used to properly assign authorship of the nodes.
  • default_uid: A default destination uid to use as the default author of nodes where a legacy owner isn't identified (for example, nodes authored by the account with uid 1 in the legacy system, since that account is not migrated).
  • default_language: Default language for the node and the node body. Defaults to LANGUAGE_NONE.
// Use another layer of common arguments to reduce duplication
$node_arguments = $common_arguments + array(
  'user_migration' => 'ExampleUser',
  'default_uid' => 1,
);

$photo_node_arguments = $node_arguments + array(
  'machine_name' => 'ExamplePhotoNode',
  'description' => t('Import Drupal 6 photo nodes'),
  'source_type' => 'photo', 
  'destination_type' => 'photo',
  'dependencies' => array('ExamplePhotoTerm'),
);
// Note we use a custom class here so we can map the term references and
// other fields - see "Extending migrate_d2d classes" below.
Migration::registerMigration('ExamplePhotoNodeMigration', 
  $photo_node_arguments['machine_name'], $photo_node_arguments);

$video_node_arguments = $node_arguments + array(
  'machine_name' => 'ExampleVideoNode',
  'description' => t('Import Drupal 6 video nodes'),
  'source_type' => 'video', 
  'destination_type' => 'video',
  'dependencies' => array('ExampleVideoTerm'),
);
// Note we use a custom class here so we can map the term references and
// other fields - see "Extending migrate_d2d classes" below.
Migration::registerMigration('ExampleVideoNodeMigration', 
  $video_node_arguments['machine_name'], $video_node_arguments);

Help improve this page

Page status: Not set

You can: