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

  1. Declare the D6 database in settings.php by using key d6. For instance:
    // settings.php
    $databases['d6']['default'] = array(
      'driver' => 'mysql',
      'database' => 'd6_database',
      'username' => 'foo',
      'password' => 'bar',
    );
    
  2. 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;
    }
    
  3. 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');
      }
    }
    
  4. Run the migration
    • Either enable migrate_ui, go to admin/content/migrate and run group node2webform
    • Or run drush migrate-import --group=node2webform

Related modules

Project information

Releases