You are here

public function MigrateCckPhoneHandler::prepare in Migrate Extras 6.2

Same name and namespace in other branches
  1. 7.2 cck_phone.inc \MigrateCckPhoneHandler::prepare()

File

./cck_phone.inc, line 36

Class

MigrateCckPhoneHandler
Primary value passed to this field must be the two letter ISO country code of the phone number.

Code

public function prepare($entity, array $instance, array $values) {
  $arguments = array();
  if (isset($values['arguments'])) {
    $arguments = array_filter($values['arguments']);
    unset($values['arguments']);
  }

  // Setup the standard Field API array for saving.
  $delta = 0;
  foreach ($values as $value) {
    $return[$delta]['country_codes'] = drupal_strtolower($value);
    $return[$delta]['number'] = isset($arguments['number']) ? $arguments['number'] : '';
    $return[$delta]['extension'] = isset($arguments['extension']) ? $arguments['extension'] : '';
    $delta++;
  }
  return isset($return) ? $return : NULL;
}