function _sf_contrib_export_location in Salesforce Suite 6.2
2 calls to _sf_contrib_export_location()
- _sf_node_export_location in sf_contrib/
sf_contrib.module - _sf_user_export_location in sf_contrib/
sf_contrib.module
1 string reference to '_sf_contrib_export_location'
- _sf_contrib_add_location in sf_contrib/
sf_contrib.module
File
- sf_contrib/
sf_contrib.module, line 323 - Provides integration with Location and CCK.
Code
function _sf_contrib_export_location($source, $fieldname, $drupal_field_definition, $sf_field_definition, $key = 'nid') {
// If locations doesn't exist, fail fast.
if (empty($source->locations)) {
return FALSE;
}
foreach ($source->locations as $location) {
if ($location['is_primary'] == 1) {
return $location[$fieldname];
}
}
// Primary not set, so make first location primary.
$source->locations[0]['is_primary'] = 1;
$criteria = array(
$key => $source->{$key},
);
location_save_locations($source->locations, $criteria);
return $source->locations[0][$fieldname];
}