Migrate Node-to-Webform
Categories
Component ID
2275081
Component name
Migrate Node-to-Webform
Component type
module
Maintenance status
Development status
Component security advisory coverage
covered
Downloads
651
Component created
Component changed
Component body
Migrates nodes (Drupal 6) to webform submissions (Drupal 7).
e.g. Retrieves all nodes of type 'article' and fills up a webform by creating one submission for each node.
Configuration
- Declare the D6 database in
settings.phpby using keyd6. For instance:// settings.php $databases['d6']['default'] = array( 'driver' => 'mysql', 'database' => 'd6_database', 'username' => 'foo', 'password' => 'bar', ); - Declare the migration in another module. For instance:
// my_module/my_module.migrate.inc /** * Implement hook_migrate_api(). */ function my_module_migrate_api() { $api = array( 'api' => 2, 'groups' => array( 'node2webform' => array('title' => t('node2webform')), ), 'migrations' => array( 'node2webform' => array( 'source_connection' => 'd6', 'source_version' => 6, 'group_name' => 'node2webform', 'class_name' => 'Node2WebformSubmissionMigration', 'machine_name' => 'node2webform', 'description' => t('My node2webform migration.'), 'source_type' => 'article', // Content-type of source nodes. 'destination_nid' => 123, // Node ID of the destination webform. ), ), ); return $api; } - You may customize CCK / webform field mappings by extending the class. For instance:
class CustomNode2WebformMigration extends Node2WebformSubmissionMigration { public function __construct(array $args) { parent::__construct($args); $this->addFieldMapping('my_d7_webform_field', 'my_d6_cck_field'); } } - Run the migration
- Either enable migrate_ui, go to
admin/content/migrateand run groupnode2webform - Or run
drush migrate-import --group=node2webform
- Either enable migrate_ui, go to
