You are here

public function EntityDefaultUIController::entityFormSubmitBuildEntity in Entity API 7

Entity submit builder invoked via entity_ui_form_submit_build_entity().

Extracts the form values and updates the entity.

The provided implementation makes use of the helper function entity_form_submit_build_entity() provided by core, which already invokes the field API attacher for fieldable entities.

Return value

object The updated entity.

See also

entity_ui_form_submit_build_entity()

File

includes/entity.ui.inc, line 487
Provides a controller for building an entity overview form.

Class

EntityDefaultUIController
Default UI controller providing admin UI.

Code

public function entityFormSubmitBuildEntity($form, &$form_state) {

  // Add the bundle property to the entity if the entity type supports bundles
  // and the form provides a value for the bundle key. Especially new entities
  // need to have their bundle property pre-populated before we invoke
  // entity_form_submit_build_entity().
  if (!empty($this->entityInfo['entity keys']['bundle']) && isset($form_state['values'][$this->entityInfo['entity keys']['bundle']])) {
    $form_state[$this->entityType]->{$this->entityInfo['entity keys']['bundle']} = $form_state['values'][$this->entityInfo['entity keys']['bundle']];
  }
  entity_form_submit_build_entity($this->entityType, $form_state[$this->entityType], $form, $form_state);
  return $form_state[$this->entityType];
}