function eck__entity__form_submit in Entity Construction Kit (ECK) 7.3
Same name and namespace in other branches
- 7 eck.entity.inc \eck__entity__form_submit()
- 7.2 eck.entity.inc \eck__entity__form_submit()
Submit function for entity form.
File
- ./
eck.entity.inc, line 500 - All the menus, pages, and functionality related to administering entities.
Code
function eck__entity__form_submit($form, &$state) {
$entity = $state['values']['entity'];
field_attach_submit($entity
->entityType(), $entity, $form, $state);
$entity_type = EntityType::loadByName($entity
->entityType());
// Let the behaviors modify the entity.
// @todo Why do we need to pass form information to the save behavior.
// This is related to eck_revisions. Is there a danger that the current
// eck_revision logic will not apply when entities are manipulated from
// code and not the UI?
eck_property_behavior_invoke_plugin($entity_type, 'entity_save', array(
'entity' => $entity,
'form' => $form,
'form_state' => $state,
));
$entity
->save();
drupal_set_message(t("Entity @entity_id - @entity_label has been saved", array(
"@entity_id" => $entity->id,
"@entity_label" => entity_label($form['#entity_type'], $entity),
)));
$uri = entity_uri($entity
->entityType(), $entity);
$state['redirect'] = $uri['path'];
}