You are here

function emfield_content_migrate_data_record_alter in Embedded Media Field 7

Implements hook_content_migrate_data_record_alter().

File

./emfield.module, line 141

Code

function emfield_content_migrate_data_record_alter(&$record, &$field, $instance) {
  if (!empty($record[$field['field_name'] . '_embed'])) {
    $provider = media_internet_get_provider($record[$field['field_name'] . '_embed']);

    // This is a hack to stop content migrate from misreading the content.
    unset($field['type']);
    if ($provider) {
      $file = $provider
        ->save();
      $record[$field['field_name'] . '_fid'] = $file->fid;
    }
  }
}