function location_feeds_set_georss_point in Location Feeds 7
Same name and namespace in other branches
- 6 location_feeds.module \location_feeds_set_georss_point()
Sets a georss:point value for the node
Parameters
$source: Field mapper source settings.
$entity: Either a user or node object depending on where this is called
$target: The target that invoked this
$value:
Return value
object
1 string reference to 'location_feeds_set_georss_point'
- _location_feeds_fill_targets in ./
location_feeds.module - Helper function to add target fields
File
- ./
location_feeds.module, line 355 - This module provides location mappers to feed importers.
Code
function location_feeds_set_georss_point($source, $entity, $target, $value) {
list($field_name, $georss, $point) = explode(':', $target);
if (!is_array($value)) {
$value = array(
$value,
);
}
// Check if this is a cck field since they're added to the node
// differently.
$cck = preg_match('/^field_.+/', $target);
foreach ($value as $i => $val) {
$val = trim($val);
list($lat, $long) = explode(' ', $val);
if ($cck) {
if (!isset($entity->{$field_name}['und'][$i]['location_settings'])) {
$entity->{$field_name}['und'][$i]['location_settings'] = location_feeds_get_field_info($field_name);
}
$entity->{$field_name}['und'][$i]['latitude'] = $lat;
$entity->{$field_name}['und'][$i]['longitude'] = $long;
}
else {
$entity->{$field_name}[$i]['latitude'] = $lat;
$entity->{$field_name}[$i]['longitude'] = $long;
}
}
return $entity;
}