You are here

public function MigrateGeoFieldHandler::prepare in Migrate Extras 7.2

File

./geofield.inc, line 35

Class

MigrateGeoFieldHandler
Primary value passed to this field must be the geometry type of the geofield: Point, LineString, Polygon

Code

public function prepare($entity, array $field_info, array $instance, array $values) {
  $arguments = array();
  if (isset($values['arguments'])) {
    $arguments = array_filter($values['arguments']);
    unset($values['arguments']);
  }
  $language = $this
    ->getFieldLanguage($entity, $field_info, $arguments);

  // Setup the standard Field API array for saving.
  $delta = 0;
  foreach ($values as $value) {
    $return[$language][$delta] = array(
      'geo_type' => $value,
    ) + array_intersect_key($arguments, $field_info['columns']);
    $delta++;
  }
  return isset($return) ? $return : NULL;
}