How to migrate data from external sources#
An easy way to import content into a multi-value Custom Field with unlimited values is
from data in JSON format, using core's
sub_process
Migrate process plugin.
Requirements#
Install Migrate Plus to get the
url
migrate source plugin, which is used to fetch and parse the JSON source file below.
Example#
For this example, create a Custom Field field called "Hyperlink" with machine name
hyperlink on the Article content type, with two Custom Field items (subfields):
- "Link text" with machine name
link_text - "URL" with machine name
link_url
The source file#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | |
The migration module#
Create a custom migration module called migrations with this structure:
1 2 3 4 5 | |
custom_field_hyperlink.yml contains the migration definition:
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 | |
Run the migration, and each JSON entry's hyperlink array will be imported as a set of
items in the unlimited-value hyperlink Custom Field.