function entity_rules_build_form_entity in Entity Rules 7
Builds entity from form_state/
@todo This doesn't work with creating Users
Return value
The updated entity.
See also
entity_ui_form_submit_build_entity()
1 call to entity_rules_build_form_entity()
- entity_rules_entity_form_validation in ./
entity_rules.module - Validation callback for forms to be validated via Rules.
File
- ./
entity_rules.module, line 651 - Module file for the Entity Rules.
Code
function entity_rules_build_form_entity($form, $form_state, $entity_type, $bundle) {
// 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($bundle) && isset($form_state['values'][$bundle])) {
$form_state[$entity_type]->{$bundle} = $form_state['values'][$bundle];
}
entity_form_submit_build_entity($entity_type, $form_state[$entity_type], $form, $form_state);
return $form_state[$entity_type];
}