public function MigrateFieldsNodeHandler::prepare in Migrate 6.2
File
- plugins/
destinations/ fields.inc, line 40 - Support for processing CCK fields
Class
- MigrateFieldsNodeHandler
- @file Support for processing CCK fields
Code
public function prepare($entity, stdClass $row) {
migrate_instrument_start('MigrateDestinationEntity->prepareFields');
// Look for Field API fields attached to this destination and handle appropriately
$migration = Migration::currentMigration();
$destination = $migration
->getDestination();
$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},
);
}
$entity->{$machine_name} = migrate_field_handler_invoke_all($entity, $instance, $entity->{$machine_name});
}
}
migrate_instrument_stop('MigrateDestinationEntity->prepareFields');
}