function _pmperson_migrate_field_data in Drupal PM (Project Management) 7.2
Same name and namespace in other branches
- 8 pmperson/includes/pmperson.migrate.inc \_pmperson_migrate_field_data()
- 7.3 pmperson/includes/pmperson.migrate.inc \_pmperson_migrate_field_data()
Helper function.
See also
1 call to _pmperson_migrate_field_data()
- pmperson_migrate_field_data in pmperson/
includes/ pmperson.migrate.inc - Migrate pmperson node fields data to drupal user bundle.
File
- pmperson/
includes/ pmperson.migrate.inc, line 554 - Migration functions for the PM Person module.
Code
function _pmperson_migrate_field_data($pmperson) {
$field_mapping = array(
'im' => 'pmperson_im',
'email' => 'pmperson_mail',
'phone' => 'pmperson_phone',
'prefix' => 'pmperson_prefix',
);
try {
$account = user_load($pmperson->user_uid);
$title = _pmperson_migrate_node_get_title($pmperson->nid);
$edit['pmperson_name'][LANGUAGE_NONE][0]['value'] = $title;
$body = _pmperson_migrate_node_get_body($pmperson->nid);
$edit['pm_description'][LANGUAGE_NONE][0]['value'] = $body;
foreach ($field_mapping as $key => $field_name) {
if ($pmperson->{$key}) {
$edit[$field_name][LANGUAGE_NONE][0]['value'] = $pmperson->{$key};
}
}
$edit['pmperson_www'][LANGUAGE_NONE][0]['url'] = $pmperson->www;
$edit['pmperson_www'][LANGUAGE_NONE][0]['title'] = $pmperson->www;
user_save($account, $edit);
} catch (EntityMetadataWrapperException $exc) {
watchdog('pmperson', 'See ' . __FUNCTION__ . '() ' . $exc
->getTraceAsString(), NULL, WATCHDOG_ERROR);
}
}