diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-05-23 07:30:56 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-05-23 07:30:56 +0000 |
commit | bb1c48af7fb1a9208517bba51329f6a73264aa3e (patch) | |
tree | 41cce448bc5bc1f7d73d25bbfd3638b7a899f669 /modules/field/field.form.inc | |
parent | 30140586346085914848805041359cf37c6e66b6 (diff) | |
download | brdo-bb1c48af7fb1a9208517bba51329f6a73264aa3e.tar.gz brdo-bb1c48af7fb1a9208517bba51329f6a73264aa3e.tar.bz2 |
- Patch #629252 by plach, yched: field_attach_form() should make available all field translations on submit.
Diffstat (limited to 'modules/field/field.form.inc')
-rw-r--r-- | modules/field/field.form.inc | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/modules/field/field.form.inc b/modules/field/field.form.inc index 61a5833bc..32c4d3a9a 100644 --- a/modules/field/field.form.inc +++ b/modules/field/field.form.inc @@ -16,19 +16,10 @@ function field_default_form($entity_type, $entity, $field, $instance, $langcode, list($id, , ) = entity_extract_ids($entity_type, $entity); } + $addition = array(); $field_name = $field['field_name']; $addition[$field_name] = array(); - // Store field information in $form_state['storage']. - $form_state['field'][$field_name][$langcode] = array( - 'field' => $field, - 'instance' => $instance, - // This entry will be populated at form build time. - 'array_parents' => array(), - // This entry will be populated at form validation time. - 'errors' => array(), - ); - // Populate widgets with default values when creating a new entity. if (empty($items) && empty($id)) { $items = field_get_default_value($entity_type, $entity, $field, $instance, $langcode); @@ -79,6 +70,16 @@ function field_default_form($entity_type, $entity, $field, $instance, $langcode, } if ($elements) { + // Store field information in $form_state. + $form_state['field'][$field_name][$langcode] = array( + 'field' => $field, + 'instance' => $instance, + // This entry will be populated at form build time. + 'array_parents' => array(), + // This entry will be populated at form validation time. + 'errors' => array(), + ); + // Also aid in theming of field widgets by rendering a classified // container. $addition[$field_name] = array( @@ -93,16 +94,6 @@ function field_default_form($entity_type, $entity, $field, $instance, $langcode, '#weight' => $instance['widget']['weight'], ); } - else { - // The field is not accessible, or the widget did not return anything. Make - // sure the items are available in the submitted form values. - foreach ($items as $delta => $item) { - $elements[$delta] = array( - '#type' => 'value', - '#value' => $item, - ); - } - } // Populate the 'array_parents' information in $form_state['field'] after // the form is built, so that we catch changes in the form structure performed |