From bb1c48af7fb1a9208517bba51329f6a73264aa3e Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 23 May 2010 07:30:56 +0000 Subject: - Patch #629252 by plach, yched: field_attach_form() should make available all field translations on submit. --- modules/field/field.form.inc | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'modules/field/field.form.inc') 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 -- cgit v1.2.3