| @@ 10-39 (lines=30) @@ | ||
| 7 | ||
| 8 | class DemoFrameworkBaseNodesGroup extends Migration { |
|
| 9 | ||
| 10 | public function __construct($arguments) { |
|
| 11 | parent::__construct($arguments); |
|
| 12 | $this->description = t('Import Group Nodes.'); |
|
| 13 | ||
| 14 | // Create a map object for tracking the relationships between source rows |
|
| 15 | $this->map = new MigrateSQLMap($this->machineName, |
|
| 16 | array( |
|
| 17 | 'title' => array( |
|
| 18 | 'type' => 'varchar', |
|
| 19 | 'length' => 255, |
|
| 20 | 'not null' => TRUE, |
|
| 21 | ), |
|
| 22 | ), |
|
| 23 | MigrateDestinationNode::getKeySchema() |
|
| 24 | ); |
|
| 25 | ||
| 26 | $import_path = drupal_get_path('module', 'df_tools_og') . '/import/'; |
|
| 27 | ||
| 28 | // Create a MigrateSource object. |
|
| 29 | $this->source = new MigrateSourceCSV($import_path . 'df_tools_og.base.nodes.group.csv', $this->csvcolumns(), array('header_rows' => 1)); |
|
| 30 | ||
| 31 | $this->destination = new MigrateDestinationNode('organic_group'); |
|
| 32 | ||
| 33 | $this->addFieldMapping('uid', 'uid')->defaultValue(1); |
|
| 34 | $this->addFieldMapping('status', 'status')->defaultValue(1); |
|
| 35 | $this->addFieldMapping('language', 'language')->defaultValue('en'); |
|
| 36 | $this->addFieldMapping('title', 'title'); |
|
| 37 | $this->addFieldMapping('body', 'body'); |
|
| 38 | $this->addFieldMapping('body:format')->defaultValue('full_html'); |
|
| 39 | } |
|
| 40 | ||
| 41 | function csvcolumns() { |
|
| 42 | $columns[0] = array('title', 'Title'); |
|
| @@ 10-40 (lines=31) @@ | ||
| 7 | ||
| 8 | class DemoFrameworkBaseNodesTranslations extends Migration { |
|
| 9 | ||
| 10 | public function __construct($arguments) { |
|
| 11 | parent::__construct($arguments); |
|
| 12 | $this->description = t('Import node translations.'); |
|
| 13 | ||
| 14 | // Create a map object for tracking the relationships between source rows |
|
| 15 | $this->map = new MigrateSQLMap($this->machineName, |
|
| 16 | array( |
|
| 17 | 'translated_title' => array( |
|
| 18 | 'type' => 'varchar', |
|
| 19 | 'length' => 255, |
|
| 20 | 'not null' => TRUE, |
|
| 21 | ), |
|
| 22 | ), |
|
| 23 | MigrateDestinationNode::getKeySchema() |
|
| 24 | ); |
|
| 25 | ||
| 26 | $import_path = drupal_get_path('module', 'df_translate') . '/import/'; |
|
| 27 | ||
| 28 | // Create a MigrateSource object. |
|
| 29 | $this->source = new MigrateSourceCSV($import_path . 'df_translate.base.nodes.translations.csv', $this->csvcolumns(), array('header_rows' => 1)); |
|
| 30 | ||
| 31 | $this->destination = new MigrateDestinationNode('page'); |
|
| 32 | ||
| 33 | $this->addFieldMapping('uid', 'uid')->defaultValue(1); |
|
| 34 | $this->addFieldMapping('status', 'status')->defaultValue(1); |
|
| 35 | $this->addFieldMapping('language', 'language'); |
|
| 36 | $this->addFieldMapping('title', 'translated_title'); |
|
| 37 | $this->addFieldMapping('body', 'body'); |
|
| 38 | $this->addFieldMapping('body:format')->defaultValue('full_html'); |
|
| 39 | $this->addFieldMapping('tnid', 'title')->sourceMigration('ImportBaseNodes'); |
|
| 40 | } |
|
| 41 | ||
| 42 | function csvcolumns() { |
|
| 43 | $columns[0] = array('title', 'Title'); |
|