You are here

Migrating programmatically created fields

First of all great work on the module, it's making things much easier already.

I've hit a problem migrating one specific content type in my setup. I've got multiple sites running Drupal 7 and they need to be kept in sync, so far so good, but one of the content types has programmatically created fields, i.e. I can't see them when I go to structure > content types > xyz > manage fields. They are created in the module code itself, the fields in question are created like this:

Comments

My thought would be to define a custom source field in the constructor to hold this, map it to the target field, and then run this code for each node in prepareRow() and fill the source field. It will more than likely slow things down, but it will allow you to generate the values you need on the fly.

One thing to note is that the list of available fields for mapping is really just a UI convenience - you can use field names that aren't in the list in field mappings just fine. In this case, on the destination side, just map to the non-field field. The source side is a little trickier - where are these programmed fields being stored in the database? You'll need to add something somewhere to query them and add them to $row so you can migrate from them.