You are here

public function MigrateLinkFieldHandler::prepare in Link 6.2

Same name and namespace in other branches
  1. 7 link.migrate.inc \MigrateLinkFieldHandler::prepare()

File

./link.migrate.inc, line 26
Support for migrate module

Class

MigrateLinkFieldHandler
@file Support for migrate module

Code

public function prepare($entity, array $instance, array $values) {
  if (isset($values['arguments'])) {
    $arguments = $values['arguments'];
    unset($values['arguments']);
  }
  else {
    $arguments = array();
  }
  $delta = 0;
  foreach ($values as $value) {
    $item = array();
    if (isset($arguments['title'])) {
      $item['title'] = $arguments['title'];
    }
    if (isset($arguments['attributes'])) {
      $item['attributes'] = $arguments['attributes'];
    }
    $item['url'] = $value;
    $return[$delta] = $item;
    $delta++;
  }
  return isset($return) ? $return : NULL;
}