You are here

public function WebformNode::__construct in Migrate Webform 7

Parameters

array $arguments:

Overrides DrupalNode6Migration::__construct

File

./node.inc, line 8

Class

WebformNode
Handling specific to a Drupal 6 source for nodes.

Code

public function __construct(array $arguments) {
  parent::__construct($arguments);
  $this->destination_type = $arguments['destination_type'];
  if (isset($arguments['roles'])) {
    $this->roles = $arguments['roles'];
  }
  $this->source_db = variable_get('migrate_webform_source_database', 'default');

  // Keep old NIDs.
  $this
    ->addFieldMapping('nid', 'nid')
    ->description('Let\'s reuse the old NIDs');
  $this
    ->removeFieldMapping('is_new');
  $this
    ->addFieldMapping('is_new')
    ->defaultvalue(TRUE);

  // Get users if configured
  // Default uid to 1 if we're not mapping it.
  if (variable_get('migrate_webform_user_map_ok', FALSE)) {
    $this
      ->removeFieldMapping('uid');
    $this
      ->addFieldMapping('uid', 'uid')
      ->sourceMigration(variable_get('migrate_webform_user_migration_class', ""))
      ->defaultValue(1);
  }
  else {
    $this
      ->removeFieldMapping('uid');
    $this
      ->addFieldMapping('uid', 'uid')
      ->defaultValue(1);
  }
}