-
Notifications
You must be signed in to change notification settings - Fork 0
/
migrate_plus.migration.horoscope_daily.yml
163 lines (163 loc) · 4.68 KB
/
migrate_plus.migration.horoscope_daily.yml
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
# Migration configuration for beer content.
id: horoscope_daily
label: Horoskopy
migration_group: horoscope
source:
# We use the XML source plugin.
plugin: url
data_fetcher_plugin: http
data_parser_plugin: xml
# Normally, this is one or more fully-qualified URLs or file paths. Because
# we can't hardcode your local URL, we provide a relative path here which
# hook_install() will rewrite to a full URL for the current site.
urls:
- /denni.xml
# Visit the URL above (relative to your site root) and look at it. You can see
# that <response> is the outer element, and each item we want to import is a
# <position> element. The item_xpath value is the xpath to use to query the
# desired elements.
item_selector: /horoscopes/horoscope
horoscope_period: 'day'
# Under 'fields', we list the data items to be imported. The first level keys
# are the source field names we want to populate (the names to be used as
# sources in the process configuration below). For each field we're importing,
# we provide a label (optional - this is for display in migration tools) and
# an xpath for retrieving that value. It's important to note that this xpath
# is relative to the elements retrieved by item_xpath.
fields:
-
name: aries_c
label: aries
selector: 'signs/sign[@id="1"]/caption'
-
name: aries_t
label: aries
selector: 'signs/sign[@id="1"]/text'
-
name: taurus_c
label: taurus
selector: 'signs/sign[@id="2"]/caption'
-
name: taurus_t
label: taurus
selector: 'signs/sign[@id="2"]/text'
-
name: gemini_c
label: gemini
selector: 'signs/sign[@id="3"]/caption'
-
name: gemini_t
label: gemini
selector: 'signs/sign[@id="3"]/text'
-
name: cancer_c
label: cancer
selector: 'signs/sign[@id="4"]/caption'
-
name: cancer_t
label: cancer
selector: 'signs/sign[@id="4"]/text'
-
name: leo_c
label: leo
selector: 'signs/sign[@id="5"]/caption'
-
name: leo_t
label: leo
selector: 'signs/sign[@id="5"]/text'
-
name: virgo_c
label: virgo
selector: 'signs/sign[@id="6"]/caption'
-
name: virgo_t
label: virgo
selector: 'signs/sign[@id="6"]/text'
-
name: libra_c
label: libra
selector: 'signs/sign[@id="7"]/caption'
-
name: libra_t
label: libra
selector: 'signs/sign[@id="7"]/text'
-
name: scorpio_c
label: scorpio
selector: 'signs/sign[@id="8"]/caption'
-
name: scorpio_t
label: scorpio
selector: 'signs/sign[@id="8"]/text'
-
name: sagittarius_c
label: sagittarius
selector: 'signs/sign[@id="9"]/caption'
-
name: sagittarius_t
label: sagittarius
selector: 'signs/sign[@id="9"]/text'
-
name: capricorn_c
label: capricorn
selector: 'signs/sign[@id="10"]/caption'
-
name: capricorn_t
label: capricorn
selector: 'signs/sign[@id="10"]/text'
-
name: aquarius_c
label: aquarius
selector: 'signs/sign[@id="11"]/caption'
-
name: aquarius_t
label: aquarius
selector: 'signs/sign[@id="11"]/text'
-
name: pisces_c
label: pisces
selector: 'signs/sign[@id="12"]/caption'
-
name: pisces_t
label: pisces
selector: 'signs/sign[@id="12"]/text'
-
name: horoscope_day
label: 'day'
selector: @day
# Under 'ids', we identify source fields populated above which will uniquely
# identify each imported item. The 'type' makes sure the migration map table
# uses the proper schema type for stored the IDs.
ids:
horoscope_day:
type: string
destination:
plugin: entity:node
process:
# Hardcode the destination node type (bundle) as 'migrate_example_beer'.
type:
plugin: default_value
default_value: horoscopes
title: horoscope_day
horoscopes_period: horoscope_period
horoscopes_aries: aries_t
horoscopes_taurus: taurus_t
horoscopes_gemini: gemini_t
horoscopes_cancer: cancer_t
horoscopes_leo: leo_t
horoscopes_virgo: virgo_t
horoscopes_libra: libra_t
horoscopes_scorpio: scorpio_t
horoscopes_sagittarius: sagittarius_t
horoscopes_capricorn: capricorn_t
horoscopes_aquarius: aquarius_t
horoscopes_pisces: pisces_t
# Some Drupal fields may have multiple components we may want to set
# separately. For example, text fields may have summaries (teasers) in
# addition to the full text value. We use / to separate the field name from
# the internal field value being set, and put it in quotes because / is a
# YAML special character.
dependencies:
enforced:
module:
- horoscope