Why would piece of content of each content type be migrated but their text formats wrong?

drupal.stackexchange https://drupal.stackexchange.com/questions/239388

  •  01-01-2021
  •  | 
  •  

Domanda

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) {
    parent::__construct($arguments);
    $this->addFieldMapping('title', 'title');
    $this->addFieldMapping('body', 'body');
    $this->addFieldMapping('taxonomy_tags_1', 'field_tags')
      ->defaultValue('tid');
    $this->addFieldMapping('field_headerimage', 'field_headerimage')
      ->sourceMigration('Files');
    $this->addFieldMapping('field_headerimage:file_class')
      ->defaultValue('MigrateFileFid');
  }
}

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'
    ),
   ...
   ...
   ...
  );
È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a drupal.stackexchange
scroll top