| @@ 9-30 (lines=22) @@ | ||
| 6 | */ |
|
| 7 | ||
| 8 | class DFSMEDSlideshowNodes extends DemoFrameworkBaseNodesUUID { |
|
| 9 | public function __construct($arguments) { |
|
| 10 | parent::__construct($arguments); |
|
| 11 | $this->description = t('Import nodes.'); |
|
| 12 | $import_path = drupal_get_path('module', 'dfs_med') . '/import/'; |
|
| 13 | // Create a MigrateSource object. |
|
| 14 | $this->source = new MigrateSourceCSV($import_path . 'dfs_med.nodes.slideshow.csv', $this->csvcolumns(), array('header_rows' => 1)); |
|
| 15 | $this->destination = new MigrateDestinationNode('slideshow_slide'); |
|
| 16 | // Created |
|
| 17 | $this->addFieldMapping('created', 'created')->defaultValue(strtotime("now")); |
|
| 18 | // Main Image |
|
| 19 | $this->addFieldMapping('field_main_image', 'image'); |
|
| 20 | $this->addFieldMapping('field_main_image:file_replace')->defaultValue(FILE_EXISTS_REPLACE); |
|
| 21 | $this->addFieldMapping('field_main_image:source_dir')->defaultValue($import_path . 'images'); |
|
| 22 | $this->addFieldMapping('field_main_image:destination_file', 'filename'); |
|
| 23 | // Link |
|
| 24 | $this->addfieldmapping('field_link', 'link'); |
|
| 25 | $this->addfieldmapping('field_link:title', 'link_title'); |
|
| 26 | // Persona |
|
| 27 | $this->addFieldMapping('field_persona', 'persona'); |
|
| 28 | // Site Section |
|
| 29 | $this->addFieldMapping('field_site_section', 'site_section')->defaultValue("Content"); |
|
| 30 | } |
|
| 31 | ||
| 32 | function csvcolumns() { |
|
| 33 | $columns[0] = array('uuid', 'UUID'); |
|
| @@ 10-31 (lines=22) @@ | ||
| 7 | ||
| 8 | class DFSWEMNewsNodes extends DemoFrameworkBaseNodesUUID { |
|
| 9 | ||
| 10 | public function __construct($arguments) { |
|
| 11 | parent::__construct($arguments); |
|
| 12 | $this->description = t('Import nodes.'); |
|
| 13 | $import_path = drupal_get_path('module', 'dfs_wem') . '/import/'; |
|
| 14 | // Create a MigrateSource object. |
|
| 15 | $this->source = new MigrateSourceCSV($import_path . 'dfs_wem.nodes.wem_news.csv', $this->csvcolumns(), array('header_rows' => 1)); |
|
| 16 | $this->destination = new MigrateDestinationNode('wem_news'); |
|
| 17 | // Image |
|
| 18 | $this->addFieldMapping('field_wem_image', 'image'); |
|
| 19 | $this->addFieldMapping('field_wem_image:file_replace')->defaultValue(FILE_EXISTS_REPLACE); |
|
| 20 | $this->addFieldMapping('field_wem_image:source_dir')->defaultValue($import_path . 'images'); |
|
| 21 | $this->addFieldMapping('field_wem_image:destination_file', 'filename'); |
|
| 22 | // Video |
|
| 23 | $this->addFieldMapping('field_wem_video', 'video')->sourceMigration('DFSWEMNewsVideo'); |
|
| 24 | $this->addFieldMapping('field_wem_video:file_class')->defaultValue('MigrateFileFid'); |
|
| 25 | // Taxonomy |
|
| 26 | $this->addFieldMapping('field_wem_interests', 'interests'); |
|
| 27 | // Persona |
|
| 28 | $this->addFieldMapping('field_persona', 'persona'); |
|
| 29 | // Site Section |
|
| 30 | $this->addFieldMapping('field_site_section', 'site_section')->defaultValue("Content"); |
|
| 31 | } |
|
| 32 | ||
| 33 | function csvcolumns() { |
|
| 34 | $columns[0] = array('title', 'Title'); |
|