function data_entity_entity_edit_form_submit in Data 7
Form submit handler for saving a data entity.
File
- data_entity/
data_entity.pages.inc, line 95 - Contains general page callbacks and associated functions.
Code
function data_entity_entity_edit_form_submit($form, &$form_state) {
//dsm($form_state, 'fs');
$data_entity = $form['#entity'];
$entity_type = $data_entity->entity_type;
// Build a pseudo entity for FieldAPI field attach.
$pseudo_entity = $form_state['values'];
unset($pseudo_entity['data'], $pseudo_entity['table']);
$pseudo_entity += $form_state['values']['data'];
$pseudo_entity = (object) $pseudo_entity;
field_attach_submit($entity_type, $pseudo_entity, $form, $form_state);
$table = $form_state['values']['table'];
$record = $form_state['values']['data'];
drupal_write_record($table->name, $record, $table->table_schema['primary key']);
// Save fields.
field_attach_update($entity_type, $pseudo_entity);
}