You are here

function _quickedit_build_entity in Quick Edit 7

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.

See also

\Drupal\quickedit\Form\QuickEditFieldForm::buildEntity() in Drupal 8.

2 calls to _quickedit_build_entity()
quickedit_field_edit_form_submit in includes/fape.inc
Form submission handler for quickedit_field_edit_form().
quickedit_field_edit_form_validate in includes/fape.inc
Form validation handler for quickedit_field_edit_form().

File

includes/fape.inc, line 78
This is now effectively a light-weight duplicate of FAPE.module, providing just the parts Quick Edit needs.

Code

function _quickedit_build_entity($form, &$form_state) {
  $entity = clone $form_state['entity'];

  // Extract form values. (Renamed to field_attach_extract_form_values() in D8.)
  field_attach_submit($form_state['entity_type'], $entity, $form, $form_state, array(
    'field_name' => $form_state['field_name'],
  ));
  $instance = field_info_instance($form_state['entity_type'], $form_state['field_name'], $form_state['bundle']);
  _quickedit_entity_set_log($entity, $instance['label']);
  return $entity;
}