function _computing_set_field in Drupal Computing 7.2
Set the value of $record entity. TODO: This is supposed to be done entirely with EntityWrapper. don't know how.
Parameters
$record:
$field_name:
$field_value:
1 call to _computing_set_field()
- computing_finish in ./
computing.module - When agent finishes a computational task, call this function to persist results back to Drupal.
File
- ./
computing.module, line 467
Code
function _computing_set_field($record, $field_name, $field_value) {
$entity_info = entity_get_info('computing_record');
$fields_info = field_info_instances('computing_record', $record->application);
if (in_array($field_name, $entity_info['schema_fields_sql']['base table'])) {
// this is a basic property.
$record->{$field_name} = $field_value;
}
else {
if (array_key_exists($field_name, $fields_info)) {
// use $wrapper to avoid direct set multi-value field, etc.
$wrapper = entity_metadata_wrapper('computing_record', $record);
$wrapper->{$field_name}
->set($field_value);
}
}
}