The addressfield module is required by the new Drupal Commerce module and it would be great if it was supported here. Can anyone help point me in the right direction? I might be able to tackle this myself with a bit of direction. Cheers.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | migrate_extras_1149890.patch | 505 bytes | drewish |
| #5 | migrate_extras_1149890.patch | 3.43 KB | drewish |
Comments
Comment #1
mikey_p commentedSupport would actually go into the addressfield module itself, look at the MigrationDestination plugins for the fields that come with core.
Comment #2
geerlingguy commentedSubscribe.
Comment #3
geerlingguy commentedOkay, so I didn't do this in the most flexible way (if I get time later, I'll try to make an inc for Addressfield, but I don't know when that'll be ;-)... but here goes:
I made (with the help of joelstein) a generic field handler that works for a few different types of fields out of the box, and put that inside mymodule.fields.inc:
Then, in my Migration class (in my case, for a user profile using profile2), I used the following bit of code in prepareRow to prepare the address field (which I map from my the below-generated 'address' to my profile's 'field_profile_address':
A lot of contrib fields are structured similarly, so the only thing you'd have to worry about is (a) adding the field's key to the registerTypes function in the FieldHandler, and (b) the depth of the array you pass to this fieldhandler - for Address Fields, I have to have a nested array to account for the field delta.
Comment #4
lsolesen commentedI could help creating the addressfield.inc if someone could give some pointers on where to put it.
Comment #5
drewish commentedHere's a handler that follows the field handler pattern used else where in migrate and migrate_extras.
Comment #6
mikeryanCommitted, thanks!
Comment #7
drewish commentedWhoops, forgot to update the README. You also might want to add it to the release notes on http://drupal.org/node/1283376 #1283376: migrate_extras 7.x-2.2
Comment #8
drewish commentedComment #9
mikeryanI've updated the README to reflect all current integrations.