1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @file |
5
|
|
|
* Migrations for Block Entities. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
class DFHeroBeans extends Migration { |
9
|
|
|
|
10
|
|
|
public function __construct($arguments) { |
11
|
|
|
parent::__construct($arguments); |
12
|
|
|
$this->description = t('Import Hero Blocks.'); |
13
|
|
|
|
14
|
|
|
// Create a map object for tracking the relationships between source rows |
15
|
|
|
$this->map = new MigrateSQLMap($this->machineName, |
16
|
|
|
array( |
17
|
|
|
'UUID' => array( |
18
|
|
|
'type' => 'varchar', |
19
|
|
|
'length' => 36, |
20
|
|
|
'not null' => FALSE, |
21
|
|
|
'description' => 'The Universally Unique Identifier.', |
22
|
|
|
) |
23
|
|
|
), |
24
|
|
|
array( |
25
|
|
|
'uuid' => array( |
26
|
|
|
'type' => 'varchar', |
27
|
|
|
'length' => 36, |
28
|
|
|
'not null' => FALSE, |
29
|
|
|
'description' => 'The Universally Unique Identifier.', |
30
|
|
|
) |
31
|
|
|
) |
32
|
|
|
); |
33
|
|
|
|
34
|
|
|
// Create a MigrateSource object. |
35
|
|
|
if (isset($arguments['path'])) { |
36
|
|
|
$import_path = $arguments['path']; |
37
|
|
|
} |
38
|
|
|
else { |
39
|
|
|
$import_path = drupal_get_path('module', 'df_tools_hero') . '/import/df_tools_hero.fpp.hero.csv'; |
40
|
|
|
} |
41
|
|
|
$this->source = new MigrateSourceCSV($import_path, array(), array('header_rows' => 1)); |
42
|
|
|
$this->destination = new MigrateDestinationBean('df_bean_hero'); |
43
|
|
|
|
44
|
|
|
$this->addFieldMapping('field_hero_image', 'Image'); |
45
|
|
|
$this->addFieldMapping('field_hero_image:file_replace')->defaultValue(FILE_EXISTS_REPLACE); |
46
|
|
|
$this->addFieldMapping('field_hero_image:source_dir')->defaultValue(dirname($import_path) . '/images'); |
47
|
|
|
$this->addFieldMapping('field_hero_image:destination_file', 'filename'); |
48
|
|
|
|
49
|
|
|
$this->addFieldMapping('field_hero_headline_1', 'Headline 1'); |
50
|
|
|
$this->addFieldMapping('field_hero_headline_2', 'Headline 2'); |
51
|
|
|
$this->addFieldMapping('field_hero_button', 'Button Link'); |
52
|
|
|
$this->addFieldMapping('field_hero_button:title', 'Button Title'); |
53
|
|
|
|
54
|
|
|
$this->addFieldMapping('label', 'Title'); |
55
|
|
|
$this->addFieldMapping('uuid', 'UUID'); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
} |
59
|
|
|
|