Révision b720ea3e
Ajouté par Assos Assos il y a plus de 8 ans
drupal7/sites/all/modules/date/date_migrate/date_migrate_example/date_migrate_example.migrate.inc | ||
---|---|---|
47 | 47 |
$xml_folder = drupal_get_path('module', 'date_migrate_example'); |
48 | 48 |
$items_url = $xml_folder . '/date_migrate_example.xml'; |
49 | 49 |
$item_xpath = '/source_data/item'; |
50 |
$item_ID_xpath = 'id';
|
|
51 |
$items_class = new MigrateItemsXML($items_url, $item_xpath, $item_ID_xpath);
|
|
50 |
$item_id_xpath = 'id';
|
|
51 |
$items_class = new MigrateItemsXML($items_url, $item_xpath, $item_id_xpath);
|
|
52 | 52 |
$this->source = new MigrateSourceMultiItems($items_class, $fields); |
53 | 53 |
$this->destination = new MigrateDestinationNode('date_migrate_example'); |
54 | 54 |
|
... | ... | |
78 | 78 |
$this->addFieldMapping('field_datestamp_range:to', 'datestamp_range_to'); |
79 | 79 |
|
80 | 80 |
// You can specify a timezone to be applied to all values going into the |
81 |
// field (Tokyo is UTC+9, no DST) |
|
81 |
// field (Tokyo is UTC+9, no DST).
|
|
82 | 82 |
$this->addFieldMapping('field_datetime', 'datetime') |
83 | 83 |
->xpath('datetime'); |
84 | 84 |
$this->addFieldMapping('field_datetime:timezone') |
... | ... | |
107 | 107 |
// The date range field can have multiple values. |
108 | 108 |
$current_row->date_range_from = array(); |
109 | 109 |
foreach ($current_row->xml->date_range as $range) { |
110 |
$current_row->date_range_from[] = (string)$range->from[0]; |
|
111 |
$current_row->date_range_to[] = (string)$range->to[0]; |
|
110 |
$current_row->date_range_from[] = (string) $range->from[0];
|
|
111 |
$current_row->date_range_to[] = (string) $range->to[0];
|
|
112 | 112 |
} |
113 | 113 |
|
114 |
$current_row->datestamp_range_from =
|
|
115 |
(string) $current_row->xml->datestamp_range->from[0]; |
|
116 |
$current_row->datestamp_range_to =
|
|
117 |
(string) $current_row->xml->datestamp_range->to[0]; |
|
118 |
|
|
119 |
$current_row->datetime_range_from =
|
|
120 |
(string) $current_row->xml->datetime_range->from[0]; |
|
121 |
$current_row->datetime_range_to =
|
|
122 |
(string) $current_row->xml->datetime_range->to[0]; |
|
123 |
$current_row->datetime_range_timezone =
|
|
124 |
(string) $current_row->xml->datetime_range->timezone[0]; |
|
125 |
|
|
126 |
$current_row->date_repeat =
|
|
127 |
(string) $current_row->xml->date_repeat->date[0]; |
|
128 |
$current_row->date_repeat_rrule =
|
|
129 |
(string) $current_row->xml->date_repeat->rule[0]; |
|
114 |
$current_row->datestamp_range_from |
|
115 |
= (string) $current_row->xml->datestamp_range->from[0];
|
|
116 |
$current_row->datestamp_range_to |
|
117 |
= (string) $current_row->xml->datestamp_range->to[0];
|
|
118 |
|
|
119 |
$current_row->datetime_range_from |
|
120 |
= (string) $current_row->xml->datetime_range->from[0];
|
|
121 |
$current_row->datetime_range_to |
|
122 |
= (string) $current_row->xml->datetime_range->to[0];
|
|
123 |
$current_row->datetime_range_timezone |
|
124 |
= (string) $current_row->xml->datetime_range->timezone[0];
|
|
125 |
|
|
126 |
$current_row->date_repeat |
|
127 |
= (string) $current_row->xml->date_repeat->date[0];
|
|
128 |
$current_row->date_repeat_rrule |
|
129 |
= (string) $current_row->xml->date_repeat->rule[0];
|
|
130 | 130 |
} |
131 | 131 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules