public function MigrateFivestarFieldHandler::prepare in Fivestar 7.2
File
- ./
fivestar.migrate.inc, line 44 - Base integration with the Migrate API class.
Class
- MigrateFivestarFieldHandler
- Custom extended MigrateFieldHandler class for FiveStar module.
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.
foreach (array_values($values) as $delta => $value) {
$return[$language][$delta] = array(
'rating' => $value,
) + array_intersect_key($arguments, $field_info['columns']);
}
return isset($return) ? $return : NULL;
}