diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-11-20 06:49:47 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-11-20 06:49:47 +0000 |
commit | 4cc8ae69a1df3d7ac1f33122c1a6afa6ba65fc0f (patch) | |
tree | fef7107ec164b66c946453221d33ed5ccd193450 /includes | |
parent | 9abb496d8a32da3e644d6c0095a89d76544ba211 (diff) | |
download | brdo-4cc8ae69a1df3d7ac1f33122c1a6afa6ba65fc0f.tar.gz brdo-4cc8ae69a1df3d7ac1f33122c1a6afa6ba65fc0f.tar.bz2 |
#830704 by fago, effulgentsia, Frando: Fixed entity forms cannot be properly extended.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/includes/common.inc b/includes/common.inc index 4ad8e08d8..c8848f5cd 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -7433,16 +7433,20 @@ function entity_form_field_validate($entity_type, $form, &$form_state) { * * During the submission handling of an entity form's "Save", "Preview", and * possibly other buttons, the form state's entity needs to be updated with the - * submitted form values. Each entity form implements its own - * $form['#builder_function'] for doing this, appropriate for the particular - * entity and form. Many of these entity builder functions can call this helper - * function to re-use its logic of copying $form_state['values'][PROPERTY] - * values to $entity->PROPERTY for all entries in $form_state['values'] that are - * not field data, and calling field_attach_submit() to copy field data. + * submitted form values. Each entity form implements its own builder function + * for doing this, appropriate for the particular entity and form, whereas + * modules may specify additional builder functions in $form['#entity_builders'] + * for copying the form values of added form elements to entity properties. + * Many of the main entity builder functions can call this helper function to + * re-use its logic of copying $form_state['values'][PROPERTY] values to + * $entity->PROPERTY for all entries in $form_state['values'] that are not field + * data, and calling field_attach_submit() to copy field data. Apart from that + * this helper invokes any additional builder functions that have been specified + * in $form['#entity_builders']. * * For some entity forms (e.g., forms with complex non-field data and forms that * simultaneously edit multiple entities), this behavior may be inappropriate, - * so the #builder_function for such forms needs to implement the required + * so the builder function for such forms needs to implement the required * functionality instead of calling this function. */ function entity_form_submit_build_entity($entity_type, $entity, $form, &$form_state) { @@ -7457,6 +7461,13 @@ function entity_form_submit_build_entity($entity_type, $entity, $form, &$form_st $entity->$key = $value; } + // Invoke all specified builders for copying form values to entity properties. + if (isset($form['#entity_builders'])) { + foreach ($form['#entity_builders'] as $function) { + $function($entity_type, $entity, $form, $form_state); + } + } + // Copy field values to the entity. if ($info['fieldable']) { field_attach_submit($entity_type, $entity, $form, $form_state); |