You are here

migrate_plus.migration.menu_links.yml in Migrate Google Sheets 8

migrate_google_sheets_example/config/install/migrate_plus.migration.menu_links.yml

File

migrate_google_sheets_example/config/install/migrate_plus.migration.menu_links.yml
View source
  1. # This migration demonstrates importing from a Google Spreadsheet XML feed.
  2. id: menu_links
  3. label: Games Site menu links with Google Spreadsheet
  4. migration_group: games_example
  5. source:
  6. plugin: url
  7. data_fetcher_plugin: http
  8. data_parser_plugin: google_sheets
  9. # The feed file for the spreadsheet. The Google Spreadsheet should be either “Public” or set to “Anyone with link can
  10. # view” in order for the feed to work. Note that the <SHEET> param is the order of the tabs and WILL change if the
  11. # tabs are re-ordered.
  12. # Template: 'https://spreadsheets.google.com/feeds/list/<KEY>/<SHEET>/public/values?alt=json'
  13. urls: 'http://spreadsheets.google.com/feeds/list/1spS1BeUIzxR1KrGK2kKzAoiFZii6vBHyLx_SA0Sb89M/1/public/values?alt=json'
  14. # Under 'fields', we list the data items to be imported. The first level keys
  15. # are the source field names we want to populate (the names to be used as
  16. # sources in the process configuration below). For each field we're importing,
  17. # we provide a label (optional - this is for display in migration tools) and
  18. # an selector (xpath) for retrieving that value. It's important to note that this xpath
  19. # is relative to the elements retrieved by item_selector.
  20. # For Google Spreadsheet XML feeds the actual columns are named with gsx: followed by the cleaned column name (lower,
  21. # limited punctuation, etc).
  22. fields:
  23. -
  24. name: id
  25. label: 'Unique identifier'
  26. selector: 'id'
  27. -
  28. name: title
  29. label: 'Title'
  30. selector: 'title'
  31. -
  32. name: path
  33. label: 'Path'
  34. selector: 'path'
  35. -
  36. name: menu_name
  37. label: 'Menu Name'
  38. selector: 'menuname'
  39. -
  40. name: external
  41. label: 'Is external?'
  42. selector: 'external'
  43. -
  44. name: weight
  45. label: 'Weight'
  46. selector: 'weight'
  47. -
  48. name: expanded
  49. label: 'Expanded'
  50. selector: 'expanded'
  51. -
  52. name: parentid
  53. label: "Parent Id"
  54. selector: 'parentid'
  55. # Under 'ids', we identify source fields populated above which will uniquely
  56. # identify each imported item. The 'type' makes sure the migration map table
  57. # uses the proper schema type for stored the IDs.
  58. ids:
  59. id:
  60. type: integer
  61. # This is the mapping of the source values to the destination.
  62. process:
  63. id: id
  64. title: title
  65. description: title
  66. menu_name: menu_name
  67. link/uri:
  68. plugin: link_uri
  69. source:
  70. - path
  71. link/options:
  72. plugin: default_value
  73. default_value: { }
  74. link/title: title
  75. route:
  76. plugin: route
  77. source:
  78. - path
  79. - '@link/options'
  80. route_name: '@route/route_name'
  81. route_parameters: '@route/route_parameters'
  82. url: '@route/url'
  83. options: '@route/options'
  84. external: external
  85. weight: weight
  86. expanded: expanded
  87. parent:
  88. plugin: menu_link_parent
  89. source:
  90. - parentid
  91. - '@menu_name'
  92. - parent_link_path
  93. destination:
  94. plugin: 'entity:menu_link_content'
  95. default_bundle: menu_link_content
  96. no_stub: true
  97. migration_dependencies:
  98. required:
  99. - upgrade_menu
  100. optional: { }