Returns a cloned entity containing updated field values.
Calling code may then validate the returned entity, and if valid, transfer it back to the form state and save it.
protected function buildEntity(array $form, array &$form_state) {
$entity = clone $form_state['entity'];
field_attach_extract_form_values($entity, $form, $form_state, array(
'field_name' => $form_state['field_name'],
));
// @todo Refine automated log messages and abstract them to all entity
// types: http://drupal.org/node/1678002.
if ($entity
->entityType() == 'node' && $entity
->isNewRevision() && !isset($entity->log)) {
$instance = field_info_instance($entity
->entityType(), $form_state['field_name'], $entity
->bundle());
$entity->log = t('Updated the %field-name field through in-place editing.', array(
'%field-name' => $instance['label'],
));
}
return $entity;
}