You are here

function geofield_set_target_wkt in Geofield 7

Same name and namespace in other branches
  1. 7.2 geofield.feeds.inc \geofield_set_target_wkt()

Feeds processor target callback for WKT source.

1 string reference to 'geofield_set_target_wkt'
geofield_feeds_processor_targets_alter in ./geofield.feeds.inc
Implements hook_feeds_node_processor_targets_alter().

File

./geofield.feeds.inc, line 160
Provides integration with Feeds module (http://drupal.org/project/feeds)

Code

function geofield_set_target_wkt($source, $entity, $target, $value) {
  $field_name = substr($target, 0, strpos($target, ':'));
  $geofield_values = array();
  if (is_array($value)) {
    foreach ($value as $key => $wkt) {
      $field = array(
        'wkt' => $wkt,
      );
      $geofield_values[] = geofield_compute_values($field, 'wkt');
    }
  }
  else {
    $field = array(
      'wkt' => $value,
    );
    $geofield_values[] = geofield_compute_values($field, 'wkt');
  }
  _geofield_set_target($source, $entity, $field_name, $geofield_values);
}