Hi,
I would very much like to use Migrate to Migrate my 400+ Weblinks nodes from a D6 site to a D7 site.
All other contenttype Migrate ok now, but with Weblinks I am unable to select the link-URL as source or as destination to Migrate from and to.And therefore this field is kept blank during and after the migration.
There is an issue over at Weblinks project; https://www.drupal.org/node/2210683, but the maintainer doesn
t use migrate.
Any one on Migrate did a Weblinks D6 - D7 migrate? Wouldn't be great to handle this also out-of-the-box?
Thanks a lot in advance for your reply!
Greetings,
Martijn
Comments
Comment #1
summit commentedHi,
On Weblinks issue queue somebody made a class for weblinks; https://www.drupal.org/node/2210683#comment-9802391
Can that be incorperated, as that the Weblinks Link-URL field is shown in source and destination?
greetings, Martijn
Comment #2
summit commentedHi,
Should with this https://www.drupal.org/node/1133448 somehow the Link-URL field be added to the node class in the particular case the migration consists of "weblinks" nodes?
https://www.drupal.org/node/1133448
Where within migrated2d should I add this then?
Or extend the node-class? https://www.drupal.org/node/1819738?
greetings, Martijn
Comment #3
mikeryanmigrate_d2d is not going to build in support for every contrib module: http://www.commitstrip.com/en/2015/04/07/just-an-exception-they-said/
It looks like the weblinks module stores its data in a custom table, rather than making use of the field API. Thus, there needs to be a field handler to expose the available columns from the table, and to write them when mapped. This should really be part of the weblinks module, but you could implement it in your own custom module (ideally, if the weblinks maintainer is not going to do it, would be if you submitted a patch to weblinks with the field handler).
Then, on the destination side, you would extend the node class to expose the source fields and add them to the node query (or, if you may have more than one weblink per row, add them to $row in prepareRow()).
Comment #4
GStegemann commentedYes, that's true.
In the meantime I got a first draft of the Web Links migration code working.
But I still wonder about the following mapping warning messages:
Any ideas why these messages will be issued?
Comment #5
summit commentedHi, I saw this on https://www.drupal.org/node/1510174
Figured out my problem. Bad coding practice. I didn't pass the $row by reference outside of prepareRow()
Don't know what it means, but may be you guys figure it out?
Greetings, Martijn
Comment #6
GStegemann commentedWhat is effectively meant by this?
Comment #7
GStegemann commentedBy extending the source query the source fields become exposed and can be mapped in the extended Node class. But what else needs to be done to make these extra fields appear in the Migrate UI Dashboard Edit Fields Mapping list?
Do you know of any examples of MigrateFieldHandler extensions supporting multiple extra fields?
Comment #8
mikeryanOn the source side, in addition to adding fields to the query, to expose them to the UI you need to add them to $this->sourceFields in your migration. E.g.
Now, in terms of the query, are weblinks rows one per node, or can you have multiple rows for a node? If no more than one per node, you can add the join in query(). However, if there can be multiple rows, that won't work right because then the query will end up return multiple complete rows per node to migrate - instead, you'll need to add the weblinks data to $row in prepareRow().
On the destination side, I may have mislead you - I think a destination handler may be more appropriate here. See migrate's sources/destinations/path.inc for a good simple example.
Comment #9
GStegemann commentedI got that part already working.
Web Links rows are only one per node. So far I got that working as well.
Thanks. I will look at your proposed example.
When I understand you right a destination handler exposes extra fields from a custom table to Migrate? And to make a destination handler available for migration purposes I have to create a weblinks.migrate.inc file including hook_migrate_api and the destination handler code itself. Correct?
Comment #10
mikeryanCorrect - the destination handler exposes any custom Drupal-side fields to the UI, and needs to be registered in hook_migrate_api in the migrate.inc file. The handler code itself doesn't need to be in the migrate.inc, but it does make it simpler to have all the migration code together in one file if there isn't too much to it (the handler class shouldn't be very large).
Comment #11
GStegemann commentedThanks for your feedback.
In the meanwhile I got the destination handler working and the migration of Web Links works so far.
But there is still another issue: associated taxonomy vocabularies with several terms per node (free tagging): for these vocabularies only one term gets migrated. All other terms will be ignored. I thought Migrate and/or migrate_d2d takes of this case as well.
What do you propose? Do I have to implement a
hook_migrate_prepare_nodefunction to catch these vocabularies and migrate all the used terms there?Comment #12
summit commentedHi Guys,
Before you go into this I think this module does what it has to do I think. Or free tagging vocabulary has something different. But it is necessary to set the vocabulary field setting to 'unlimited' terms. It was my stupid mistake that I didn't think abou this. When the ingredients of this migrate module fit it is absolutely great! Sorry to take both your time for a setting!
Greetings, Martijn
Comment #13
GStegemann commentedMartijn, thanks for keeping us posted. But no worries, I haven't spent any time for investigations yet.
Comment #14
mikeryanAre you all set with the weblinks migration? Can we close this?
Thanks.
Comment #15
summit commentedHi Mike, I think so, see: https://www.drupal.org/node/2210683. Now also possible to migrate geofield :)
greetings, Martijn
Comment #16
mikeryan