-
-
Save vinmassaro/a7bce8175aa3cafffc2035092b0fe7be to your computer and use it in GitHub Desktop.
D6->D7 migration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_migrate_api(). | |
*/ | |
function news_migrate_migrate_api() { | |
/** | |
* Declare the api version and migration group. | |
*/ | |
$api = array( | |
'api' => 2, | |
'groups' => array( | |
'News' => array( | |
'title' => t('News'), | |
), | |
), | |
'migrations' => array( | |
'Article' => array( | |
'description' => t('Migration of articles from Drupal 6'), | |
'class_name' => 'NewsArticleMigration', | |
'group_name' => 'News', | |
'source_type' => 'article', | |
'destination_type' => 'archive_article', | |
'source_connection' => 'legacy', | |
'source_version' => 6, | |
'format_mappings' => array(3 => 'filtered_html'), | |
), | |
'Taxonomy' => array( | |
'class_name' => 'NewsTermMigration', | |
'description' => t('Migration of Topics terms from Drupal 6'), | |
'group_name' => 'News', | |
'source_vocabulary' => '1', // D6 Vocabulary ID | |
'destination_vocabulary' => 'archive_topics', | |
'source_connection' => 'legacy', | |
'source_version' => 6, | |
), | |
'User' => array( | |
'description' => t('Migration of users from Drupal 6'), | |
'class_name' => 'DrupalUser6Migration', | |
'group_name' => 'News', | |
'source_connection' => 'legacy', | |
'source_version' => 6, | |
) | |
), | |
); | |
return $api; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Common mappings for the Drupal 6 node migrations. | |
*/ | |
class NewsArticleMigration extends DrupalNode6Migration { | |
public function __construct(array $arguments) { | |
// Add any other data we're pulling into the source row, before the parent | |
// constructor. | |
parent::__construct($arguments); | |
$this->addFieldMapping('field_link_to_external_story', 'field_external_link'); | |
$this->addFieldMapping('field_alternate_title','field_secondary_title'); | |
$this->addFieldMapping('field_archive_topics', '1') | |
->sourceMigration('Taxonomy'); | |
$this->addFieldMapping('field_archive_topics:source_type') | |
->defaultValue('tid'); | |
} | |
/** | |
* Implements Migration::prepareRow(). | |
*/ | |
public function prepareRow($row) { | |
drush_print_r($row); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment