Commit 6368c175 authored by Jonathan Hunt's avatar Jonathan Hunt

#7 Migrate pitch as custom compound field with subfields.

parent 3661537f
......@@ -27,7 +27,7 @@ class ClimbNZRouteMigration extends DrupalNode6Migration {
// Type is mapped from taxonomy term in prepareRow().
$this->addFieldMapping('field_route_type', 'field_type');
$this->addFieldMapping('field_description', 'field_description');
$this->addFieldMapping('field_description', 'body');
//$this->addFieldMapping('field_description:format', NULL, FALSE)
// ->defaultValue('full_html');
$this->addFieldMapping('field_description:format', 'field_description:format')
......@@ -39,6 +39,22 @@ class ClimbNZRouteMigration extends DrupalNode6Migration {
$this->addFieldMapping('field_grade', 'field_grade')
->callback('trim');
// field_pitch
$this->addFieldMapping('field_pitch', 'field_pitch');
$this->addFieldMapping('field_pitch:grade_ewbank', 'field_pitch:grade_ewbank');
$this->addFieldMapping('field_pitch:grade_alpine_technical', 'field_pitch:grade_alpine_technical');
$this->addFieldMapping('field_pitch:grade_alpine_commitment', 'field_pitch:grade_alpine_commitment');
$this->addFieldMapping('field_pitch:grade_alpine_mtcook', 'field_pitch:grade_alpine_mtcook');
$this->addFieldMapping('field_pitch:grade_aid', 'field_pitch:grade_aid');
$this->addFieldMapping('field_pitch:grade_water_ice', 'field_pitch:grade_water_ice');
$this->addFieldMapping('field_pitch:grade_mixed', 'field_pitch:grade_mixed');
$this->addFieldMapping('field_pitch:grade_boulder', 'field_pitch:grade_boulder');
$this->addFieldMapping('field_pitch:length', 'field_pitch:length');
$this->addFieldMapping('field_pitch:bolts', 'field_pitch:bolts');
$this->addFieldMapping('field_pitch:trad', 'field_pitch:trad');
$this->addFieldMapping('field_pitch:description', 'field_pitch:description');
$this->addFieldMapping('field_ascent', 'field_ascent');
$this->addFieldMapping('field_attribution', 'field_attribution');
......@@ -55,9 +71,6 @@ class ClimbNZRouteMigration extends DrupalNode6Migration {
$this->addFieldMapping('field_natural_pro', 'field_natural')
->callbacks(array($this, 'mapBoolean'));
$this->addFieldMapping('field_pitches', 'field_pitch')
->sourceMigration('Pitch');
// D6 Image field.
$this->addFieldMapping('field_route_image', 'field_route_image')
->sourceMigration('File');
......@@ -97,17 +110,10 @@ class ClimbNZRouteMigration extends DrupalNode6Migration {
if (parent::prepareRow($row) === FALSE) {
return FALSE;
}
}
// Map to child pitches via compound key of route nid and pitch field delta.
// A callback for field_pitches is too late, due to migrate sourceMigration magic.
if (count($row->field_pitch)) {
foreach ($row->field_pitch as $key => $bogus) {
$row->field_pitch[$key] = array('nid' => $row->nid, 'delta' => $key);
}
}
// fix mapGone()
//$row->field_gone = $row->field_gone == 'yes' ? 1 : 0;
public function complete($node, stdClass $source_row) {
//xdebug_break();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment