I'm trying to migrate content D6 -> D7. I've written the importers (actually just edited existing ones) and run the process. However, as far as I can see, body of content are imported but with the wrong format i.e. one of them correctly shows as Full HTML while another shows just Select. text format wrong

Below is my importer:

class StoryMigration extends NodeMigration {
  public function __construct(array $arguments) {
    $this->addFieldMapping('title', 'title');
    $this->addFieldMapping('body', 'body');
    $this->addFieldMapping('taxonomy_tags_1', 'field_tags')
    $this->addFieldMapping('field_headerimage', 'field_headerimage')

UPDATE: I also did a format mapping, like below:

$common_arguments = array(
    'source_connection' => 'default',
    'source_version' => 6,
    'format_mappings' => array(
      '1' => 'filtered_html',
      '2' => 'full_html',
      '3' => 'php_code'
  • I see you extend NodeMigration - is this the migrate_d2d module, or the core migrate module? It has been a while since I have seen migrate, but I never used migrate_d2d (preferred to roll my own). – Kevin Jun 28 '17 at 2:37
  • It's the migrate_d2d module. – Kartagis Jun 28 '17 at 10:11

You need to map the body format.

This is from 6 years ago, but reposting in case mikeryan does not see this question.

if the format is part of the source data (i.e., it varies from node to node), you can make use of the source_field feature:

$this->addFieldMapping('body', 'body')
     ->arguments(array('format' => array('source_field' => 'body_format'));

Where body_format is the value from the source db I believe.

It has been a loooong time since I have done a 6 to 7 migration.

This post might also be of use if you are using migrate_d2d.

  • I finally did it. I compared one correctly imported post and one failed. Correct one was Full HTML and failed was Filtered HTML. So I looked at the formats and Filtered HTML wasn't there so I created it. Additionally, I chose to migrate Filtered HTML for both source and destination. – Kartagis Jun 28 '17 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.