Skip to content
Snippets Groups Projects
Commit 0f1f971d authored by Mathew Winstone's avatar Mathew Winstone
Browse files

Added keying by remote key

parent 4ce1a5ce
Branches wsfieldswrite
No related tags found
No related merge requests found
......@@ -337,7 +337,7 @@ function wsfields_data_write($entity_type, $entity, $op, $field, $items) {
// Load required settings from the field instance
$wsconfig_name = $field['storage']['settings']['wsconfig_name'];
$remotename = $field['storage']['settings']['remotekey'];
$remotekey = $field['storage']['settings']['remotekey'];
$passaccepts = isset($field['storage']['settings']['passaccepts']) ? $field['storage']['settings']['passaccepts'] : TRUE;
$processor = $field['storage']['settings']['processor'];
$propertymap = $field['storage']['settings']['propertymap']['read'];
......@@ -363,9 +363,11 @@ function wsfields_data_write($entity_type, $entity, $op, $field, $items) {
$value = FALSE;
if (isset($ws_keys[$entity_property])) {
$value = $ws_keys[$entity_property];
} elseif (isset($entity->$entity_property)) {
}
elseif (isset($entity->$entity_property)) {
$value = $entity->$entity_property;
} else {
}
else {
if (WSFIELDS_DEBUG) debug("Couldn't find pattern: " . $pattern);
return FALSE;
}
......@@ -403,6 +405,17 @@ function wsfields_data_write($entity_type, $entity, $op, $field, $items) {
$options['accept-type'] = array_pop($type);
}
// Key the items based on the remote key
if (count($items) > 1) {
// @todo
}
else {
$items = reset($items);
// @todo figure out how to support fields with different column names
$items[$remotekey] = $items['value'];
unset($items['value']);
}
// Write the data
$data = $wsconfig->call($op, $replacements, $items, $options);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment