-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmigrate_plus.migration.horoscope_monthly.yml
86 lines (85 loc) · 2.8 KB
/
migrate_plus.migration.horoscope_monthly.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
# Migration configuration for beer content.
id: horoscope_monthly
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:
- /mesicni.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/signs/sign
horoscope_period: 'month'
# 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: sign
label: sign
selector: caption
-
name: adon1
label: adon1
selector: 'adOns/adOn[@id="1"]'
-
name: adon2
label: adon2
selector: 'adOns/adOn[@id="2"]'
-
name: adon3
label: adon3
selector: 'adOns/adOn[@id="3"]'
-
name: adon4
label: adon4
selector: 'adOns/adOn[@id="4"]'
-
name: sign_id
label: sign_id
selector: @id
-
name: sign_strid
label: sign_strid
selector: @strId
# 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:
sign_id:
type: string
destination:
plugin: entity:node
process:
# Hardcode the destination node type (bundle) as 'migrate_example_beer'.
type:
plugin: default_value
default_value: horoscope
title: sign
field_horoscope_sign: sign_strid
field_horoscope_sign_id: sign_id
field_horoscope_period: horoscope_period
field_horoscope_adon1: adon1
field_horoscope_adon2: adon2
field_horoscope_adon3: adon3
field_horoscope_adon4: adon4
# 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