You are here

public function MigrateFieldsNodeHandler::complete in Migrate 6.2

File

plugins/destinations/fields.inc, line 62
Support for processing CCK fields

Class

MigrateFieldsNodeHandler
@file Support for processing CCK fields

Code

public function complete($entity, stdClass $row) {
  migrate_instrument_start('MigrateDestinationEntity->completeFields');

  // Look for Field API fields attached to this destination and handle appropriately
  $migration = Migration::currentMigration();
  $destination = $migration
    ->getDestination();
  $entity_type = $destination
    ->getEntityType();
  $bundle = $destination
    ->getBundle();
  $info = content_types($bundle);
  $instances = $info['fields'];
  foreach ($instances as $machine_name => $instance) {
    if (property_exists($entity, $machine_name)) {

      // Normalize to an array
      if (!is_array($entity->{$machine_name})) {
        $entity->{$machine_name} = array(
          $entity->{$machine_name},
        );
      }
      migrate_field_handler_invoke_all($entity, $instance, $entity->{$machine_name}, 'complete');
    }
  }
  migrate_instrument_stop('MigrateDestinationEntity->completeFields');
}