-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdata_snapshots.import.inc
217 lines (210 loc) · 6.65 KB
/
data_snapshots.import.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<?php
/**
* Implementation of hook_feeds_importer_default().
*/
function data_snapshots_feeds_importer_default() {
$export = array();
$feeds_importer = new stdClass();
$feeds_importer->disabled = FALSE; /* Edit this to true to make a default feeds_importer disabled initially */
$feeds_importer->api_version = 1;
$feeds_importer->id = 'data_snapshot_importer';
$feeds_importer->config = array(
'name' => 'Data Snapshot Importer',
'description' => 'Imports Data Snapshot nodes from a CSV file via an HTTP URL',
'fetcher' => array(
'plugin_key' => 'FeedsHTTPFetcher',
'config' => array(
'auto_detect_feeds' => FALSE,
'use_pubsubhubbub' => FALSE,
'designated_hub' => '',
'request_timeout' => NULL,
),
),
'parser' => array(
'plugin_key' => 'FeedsCSVParser',
'config' => array(
'delimiter' => ',',
'no_headers' => 0,
),
),
'processor' => array(
'plugin_key' => 'FeedsNodeProcessor',
'config' => array(
'expire' => '-1',
'author' => 0,
'authorize' => 0,
'mappings' => array(
0 => array(
'source' => 'guid',
'target' => 'guid',
'unique' => 1,
),
1 => array(
'source' => 'dsmn',
'target' => 'field_ds_dsds_mn',
'unique' => FALSE,
),
2 => array(
'source' => 'ptk',
'target' => 'field_ds_ptk',
'unique' => FALSE,
),
3 => array(
'source' => 'stk',
'target' => 'field_ds_stk',
'unique' => FALSE,
),
4 => array(
'source' => 'title',
'target' => 'title',
'unique' => 0,
),
5 => array(
'source' => 'image_url',
'target' => 'field_ds_disimg:url',
'unique' => FALSE,
),
6 => array(
'source' => 'about',
'target' => 'body',
'unique' => FALSE,
),
),
'update_existing' => '0',
'input_format' => 'plain_text',
'skip_hash_check' => 0,
'bundle' => 'data_snapshot',
),
),
'content_type' => '',
'update' => 0,
'import_period' => '-1',
'expire_period' => 3600,
'import_on_create' => 1,
'process_in_background' => 0,
);
$export['data_snapshots'] = $feeds_importer;
return $export;
}
// function data_snapshots_module_implements_alter(&$module_list, $context){
// if (array_key_exists('data_snapshots', $module_list)) {
// $a_foofoo = $context;
// }
// if($context === "node_insert") {
// $temp = $module_list['data_snapshots'];
// // Removing the data_snapshots key/value
// unset($module_list['data_snapshots']);
// // Adding the data_snapshots key value as the last member in the list
// $module_list['data_snapshots'] = $temp;
// }
// }
//
// function data_snapshots_feeds_processor_targets_alter(&$target, $type, $bundle) {
// if ($bundle == 'data_snapshots') {
// $target['data_snapshots_image_480'] = array(
// 'name' => t('Altered Data Image 480'),
// 'description' => t('Altered Data Snapshots Image 480!!!'),
// 'callback' => 'data_snapshots_set_target',
// );
// }
// }
//
// function data_snapshots_feeds_processor_targets() {
// dsm('hey ho!');
// }
//
// function data_snapshots_set_target($source, $entity, $target, $value, $mapping) {
// $entity->{$target}[$entity->language][0]['value'] = $value;
// if (isset($source->importer->processor->config['input_format'])) {
// $entity->{$target}[$entity->language][0]['format'] =
// $source->importer->processor->config['input_format'];
// }
// }
//
// function data_snapshots_foo_callback() {
// dsm('data_snapshots_foo_callback !!!');
// }
//
// function data_snapshots_my_setter_callback($source, $entity, $mapping_target, $value, $mapping) {
// dsm($entity);
// dsm($value);
// //'data_snapshots_image_480',
// }
//xxx /**
//xxx * Implementation of hook_feeds_importer_default().
//xxx */
//xxx function CSV_data_snapshots_feeds_importer_default() {
//xxx $export = array();
//xxx
//xxx $feeds_importer = new stdClass;
//xxx $feeds_importer->disabled = FALSE; /* Edit this to true to make a default feeds_importer disabled initially */
//xxx $feeds_importer->api_version = 1;
//xxx $feeds_importer->id = 'data_snapshots';
//xxx $feeds_importer->config = array(
//xxx 'name' => 'Data Snapshots import',
//xxx 'description' => 'Import data snapshots nodes from CSV file.',
//xxx 'fetcher' => array(
//xxx 'plugin_key' => 'FeedsFileFetcher',
//xxx 'config' => array(
//xxx 'direct' => FALSE,
//xxx ),
//xxx ),
//xxx 'parser' => array(
//xxx 'plugin_key' => 'FeedsCSVParser',
//xxx 'config' => array(
//xxx 'delimiter' => ',',
//xxx ),
//xxx ),
//xxx 'processor' => array(
//xxx 'plugin_key' => 'FeedsNodeProcessor',
//xxx 'config' => array(
//xxx 'bundle' => 'data_snapshots',
//xxx 'update_existing' => 1,
//xxx 'expire' => '-1',
//xxx 'mappings' => array(
//xxx 0 => array(
//xxx 'source' => 'title',
//xxx 'target' => 'title',
//xxx 'unique' => FALSE,
//xxx ),
//xxx 2 => array(
//xxx 'source' => 'year',
//xxx 'target' => 'data_snapshots_year',
//xxx 'unique' => FALSE,
//xxx ),
//xxx 3 => array(
//xxx 'source' => 'month',
//xxx 'target' => 'data_snapshots_month',
//xxx 'unique' => FALSE,
//xxx ),
//xxx 4 => array(
//xxx 'source' => 'day',
//xxx 'target' => 'data_snapshots_day',
//xxx 'unique' => FALSE,
//xxx ),
//xxx 5 => array(
//xxx 'source' => 'image_480',
//xxx 'target' => 'data_snapshots_image_480',
//xxx 'unique' => FALSE,
//xxx ),
//xxx 6 => array(
//xxx 'source' => 'image_620',
//xxx 'target' => 'data_snapshots_image_620',
//xxx 'unique' => FALSE,
//xxx ),
//xxx ),
//xxx 'input_format' => 'plain_text',
//xxx 'author' => 0,
//xxx ),
//xxx ),
//xxx 'content_type' => '',
//xxx 'update' => 0,
//xxx 'import_period' => '-1',
//xxx 'expire_period' => 3600,
//xxx 'import_on_create' => 1,
//xxx );
//xxx $export['data_snapshots'] = $feeds_importer;
//xxx
//xxx return $export;
//xxx }
//xxx