You are here

migrate_plus.migration.node_game.yml in Migrate Google Sheets 2.x

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

File

migrate_google_sheets_example/config/install/migrate_plus.migration.node_game.yml
View source
  1. # This migration demonstrates importing from a Google Spreadsheet XML feed.
  2. id: node_game
  3. label: Games Site node "games" 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/3/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: status
  33. label: 'Status'
  34. selector: 'status'
  35. -
  36. name: path
  37. label: 'Path'
  38. selector: 'path'
  39. -
  40. name: redirect
  41. label: 'Redirect'
  42. selector: 'redirect'
  43. -
  44. name: image
  45. label: 'Image'
  46. selector: 'image'
  47. -
  48. name: imagefilename
  49. label: 'Image Filename'
  50. selector: 'imagefilename'
  51. -
  52. name: imagealt
  53. label: 'Image Alt'
  54. selector: 'imagealt'
  55. -
  56. name: imagetitle
  57. label: 'Image Title'
  58. selector: 'imagetitle'
  59. -
  60. name: subhead
  61. label: 'Subhead'
  62. selector: 'subhead'
  63. -
  64. name: summary
  65. label: 'Summary'
  66. selector: 'summary'
  67. -
  68. name: body
  69. label: 'Body'
  70. selector: 'body'
  71. -
  72. name: topic
  73. label: 'Topic'
  74. selector: 'topic'
  75. -
  76. name: relatedblocks
  77. label: 'Related Blocks'
  78. selector: 'relatedblocks'
  79. # Under 'ids', we identify source fields populated above which will uniquely
  80. # identify each imported item. The 'type' makes sure the migration map table
  81. # uses the proper schema type for stored the IDs.
  82. ids:
  83. id:
  84. type: integer
  85. # This is the mapping of the source values to the destination.
  86. process:
  87. type:
  88. plugin: default_value
  89. default_value: game
  90. # Note that the source field names here (id and title) were
  91. # defined by the 'fields' configuration for the source plugin above.
  92. title: title
  93. status: status
  94. path/pathauto:
  95. plugin: default_value
  96. default_value: 0 # Disable pathauto.
  97. path/alias: path
  98. field_subhead: subhead
  99. body/value: body
  100. body/summary: summary
  101. body/format:
  102. plugin: default_value
  103. default_value: full_html
  104. public_file_directory:
  105. plugin: default_value
  106. default_value: 'public://'
  107. public_file_uri:
  108. plugin: concat
  109. delimiter: ''
  110. source:
  111. - '@public_file_directory'
  112. - imagefilename
  113. field_image/target_id:
  114. -
  115. plugin: file_copy
  116. source:
  117. - image
  118. - '@public_file_uri'
  119. -
  120. plugin: entity_generate
  121. field_image/alt: imagealt
  122. field_image/title: imagetitle
  123. field_related_blocks:
  124. -
  125. plugin: explode
  126. source: relatedblocks
  127. delimiter: ;
  128. -
  129. plugin: callback
  130. callable: trim
  131. -
  132. plugin: migration
  133. migration: blocks
  134. destination:
  135. plugin: entity:node
  136. migration_dependencies:
  137. required:
  138. - blocks