Skip to content

Instantly share code, notes, and snippets.

@kyleskrinak
Created November 22, 2015 12:02
Show Gist options
  • Save kyleskrinak/3e7050b627cc3fa9d899 to your computer and use it in GitHub Desktop.
Save kyleskrinak/3e7050b627cc3fa9d899 to your computer and use it in GitHub Desktop.
Extends migrate_d2d's D7/node.inc
<?php
/**
* Common mappings for the Drupal 7 node migrations for Divinity.
*/
abstract class DivinityNodeMigration extends DrupalNode7Migration {
public function __construct(array $arguments) {
parent::__construct($arguments);
$this->addUnmigratedDestinations(array(
'pathauto',
'metatag_title',
'metatag_description',
'metatag_abstract',
'metatag_keywords',
'metatag_robots',
'metatag_news_keywords',
'metatag_standout',
'metatag_rating',
'metatag_referrer',
'metatag_generator',
'metatag_rights',
'metatag_image_src',
'metatag_canonical',
'metatag_shortlink',
'metatag_publisher',
'metatag_author',
'metatag_original-source',
'metatag_prev',
'metatag_next',
'metatag_revisit-after',
'metatag_content-language',
'metatag_geo.position',
'metatag_geo.placename',
'metatag_geo.region',
'metatag_icbm',
'metatag_refresh',
), NULL, FALSE);
$this->addUnmigratedSources(array(
'revision',
'revision_uid',
));
}
}
/**
* Implementation of Migration::prepareRow().
*
* Here we pull in additional data from a non-core, non-CCK table.
*
* @param $row
*/
/*
public function prepareRow($row) {
if (parent::prepareRow($row) === FALSE) {
return FALSE;
}
$image_row = Database::getConnection('default', $this->sourceConnection)
->select('custom_image_table', 'i')
->fields('i', array('copyright', 'filename'))
->condition('vid', $row->vid)
->execute()
->fetchObject();
if ($image_row) {
$row->copyright = $image_row->copyright;
$row->filename = $image_row->filename;
}
else {
$this->saveMessage(t('No custom_image_table data for image node with vid !vid',
array('!vid' => $row->vid)));
}
}
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment