You are here

public function DrupalNode7Migration::__construct in Drupal-to-Drupal data migration 7.2

Parameters

array $arguments:

Overrides DrupalNodeMigration::__construct

File

d7/node.inc, line 22
Implementation of DrupalNodeMigration for Drupal 7 sources.

Class

DrupalNode7Migration
Handling specific to a Drupal 7 source for nodes.

Code

public function __construct(array $arguments) {
  parent::__construct($arguments);

  // Remove fields no longer relevent in D7 (now part of the body field).
  unset($this->sourceFields['format']);
  unset($this->sourceFields['teaser']);
  $this->source = new MigrateSourceSQL($this
    ->query(), $this->sourceFields, NULL, $this->sourceOptions);
  $this
    ->addFieldMapping('language', 'language')
    ->defaultValue($this->defaultLanguage);
  if (field_info_instance('node', 'body', $this->destinationType)) {
    $this
      ->addFieldMapping('body:summary', 'body:summary');
    $this
      ->addFieldMapping('body:format', 'body:format')
      ->callbacks(array(
      $this,
      'mapFormat',
    ));
  }
  else {
    $this
      ->addUnmigratedSources(array(
      'body:summary',
      'body:format',
    ));
  }
  if (module_exists('media')) {
    $this
      ->addFieldMapping('body', 'body', FALSE)
      ->callbacks(array(
      $this,
      'remapMediaJson',
    ));
  }
  $this
    ->addSimpleMappings(array(
    'tnid',
    'translate',
  ));
}