You are here

public function MigrateAddressFieldHandler::prepare in Address Field 7

Implements MigrateFieldHandler::prepare().

Parameters

$entity:

array $field_info:

array $instance:

array $values:

Return value

null

File

./addressfield.migrate.inc, line 113
Base integration with the Migrate API class.

Class

MigrateAddressFieldHandler
Primary value passed to this field must be the two letter ISO country code of the address.

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(
      'country' => $value,
    ) + $this
      ->prepareArguments($arguments, $field_info, $delta);
    $delta++;
  }
  return isset($return) ? $return : NULL;
}