public function MigrateSafewordFieldHandler::prepare in Safeword 7
Same name and namespace in other branches
- 8 safeword.migrate.inc \MigrateSafewordFieldHandler::prepare()
File
- ./
safeword.migrate.inc, line 49 - Support for migrate module.
Class
- MigrateSafewordFieldHandler
- Custom extended MigrateFieldHandler class for the Safeword module.
Code
public function prepare($entity, array $field_info, array $instance, array $values) {
// Change the format of the arguments for getFieldLanguage().
$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.
foreach (array_values($values) as $delta => $value) {
$item = array();
if (isset($arguments['machine'])) {
$item['machine'] = $arguments['machine'];
}
$item['human'] = $value;
$return[$language][$delta] = $item;
}
return isset($return) ? $return : NULL;
}