I wondered how "cck fields"-views should be converted to fieldapi fields.

function node_views_convert($display, $type, &$view, &$field, $id = NULL) {
  _views_convert_rename_table($field, 'node_revisions', 'node_revision');
  switch ($type) {
    case 'field':
      // convert node body to fieldapi.
      _views_convert_rename_table_field($field, 'node_revision', 'body', 'field_data_body', 'entity_id');
      break;

I guess this module could implement the api.

Comments

joachim’s picture

I don't know much about hook_views_convert(). When should it run? Field converter does its work in a batch operation on request, so I'm not sure implementing this hook would work.

dawehner’s picture

As far as i read the module you have a hook to define the migration paths.

You could implement hook_views_convert and read out every migration path and use it on the hook.

joachim’s picture

When does hook_views_convert get invoked?

dawehner’s picture

Currently only when someone is calling

views_include('convert');
views_convert_from_6($name);

There is sadly no ui currently.

joachim’s picture

Ah right. Now I get it! :)

So we could add a setting to a migration plan, say

'convert_views' => TRUE

and if that's set, Field converter knows it should invoke hook_views_convert because the migration plan's module has that hook and wants it to run at the same time as the field conversion.

dawehner’s picture

Exact.