migrate_plus.migration.wine_variety_multi_xml.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # This migration demonstrates importing from multiple XML files.
  2. id: wine_variety_multi_xml
  3. label: XML feed of varieties
  4. migration_group: wine
  5. source:
  6. # We use the XML source plugin.
  7. plugin: url
  8. data_fetcher_plugin: http
  9. data_parser_plugin: xml
  10. # Normally, this is one or more fully-qualified URLs or file paths. Because
  11. # we can't hardcode your local URL, we provide a relative path here which
  12. # hook_install() will rewrite to a full URL for the current site.
  13. urls:
  14. - /migrate_example_advanced_variety_multiple/red?_format=xml
  15. - /migrate_example_advanced_variety_multiple/white?_format=xml
  16. # Visit the URL above (relative to your site root) and look at it. You can see
  17. # that <response> is the outer element, and each item we want to import is a
  18. # <position> element. The item_xpath value is the xpath to use to query the
  19. # desired elements.
  20. item_selector: /response/variety
  21. # Under 'fields', we list the data items to be imported. The first level keys
  22. # are the source field names we want to populate (the names to be used as
  23. # sources in the process configuration below). For each field we're importing,
  24. # we provide a label (optional - this is for display in migration tools) and
  25. # an xpath for retrieving that value. It's important to note that this xpath
  26. # is relative to the elements retrieved by item_xpath.
  27. fields:
  28. -
  29. name: category_name
  30. label: Name
  31. selector: name
  32. -
  33. name: category_details
  34. label: Details
  35. selector: details
  36. -
  37. name: category_parent
  38. label: 'Unique position identifier'
  39. selector: parent
  40. -
  41. name: category_attributes
  42. label: 'List of variety attributes'
  43. selector: attributes
  44. # Under 'ids', we identify source fields populated above which will uniquely
  45. # identify each imported item. The 'type' makes sure the migration map table
  46. # uses the proper schema type for stored the IDs.
  47. ids:
  48. category_name:
  49. type: string
  50. process:
  51. vid:
  52. plugin: default_value
  53. default_value: migrate_example_wine_varieties
  54. name: category_name
  55. description: category_details
  56. parent:
  57. plugin: migration
  58. migration: wine_terms
  59. source: category_parent
  60. field_variety_attributes: category_attributes
  61. destination:
  62. plugin: entity:taxonomy_term
  63. migration_dependencies:
  64. required:
  65. - wine_terms
  66. dependencies:
  67. enforced:
  68. module:
  69. - migrate_example_advanced