You are here

public function MigrateSimpleFieldHandler::prepare in Migrate 6.2

Same name and namespace in other branches
  1. 7.2 plugins/destinations/fields.inc \MigrateSimpleFieldHandler::prepare()

File

plugins/destinations/fields.inc, line 130
Support for processing CCK fields

Class

MigrateSimpleFieldHandler
Base class for creating field handlers for fields with a single value.

Code

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

  // Let the derived class skip empty values.
  if ($this->skipEmpty) {
    $values = array_filter($values, array(
      $this,
      'notNull',
    ));
  }

  // Setup the Field API array for saving.
  $delta = 0;
  foreach ($values as $value) {
    $return[$delta][$this->fieldValueKey] = $value;
    $delta++;
  }
  return isset($return) ? $return : NULL;
}