? actions.patch ? form_values.patch ? sites/actions Index: includes/form.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/form.inc,v retrieving revision 1.215 diff -u -p -r1.215 form.inc --- includes/form.inc 12 Jul 2007 11:03:54 -0000 1.215 +++ includes/form.inc 14 Jul 2007 13:23:22 -0000 @@ -1,5 +1,5 @@ array()); foreach ($form['#default_value'] as $key) { @@ -919,14 +923,16 @@ function form_type_checkbox_value($form, * element. * * @param $form - * Form element we are trying to determine a value for. + * The form element whose value is being populated. * @param $edit - * Relevant post data for real value, or NULL for default value + * The incoming POST data to populate the form element. If this is FALSE, + * the element's default value should be returned. * @return - * Mixed, value to be assigned to element. + * The data that will appear in the $form_state['values'] collection + * for this element. Return nothing to use the default. */ -function form_type_password_confirm_value($form, $edit = NULL) { - if (!isset($edit)) { +function form_type_password_confirm_value($form, $edit = FALSE) { + if ($edit === FALSE) { $form += array('#default_value' => array()); return $form['#default_value'] + array('pass1' => '', 'pass2' => ''); } @@ -936,14 +942,16 @@ function form_type_password_confirm_valu * Helper function to determine the value for a select form element. * * @param $form - * Form element we are trying to determine a value for. + * The form element whose value is being populated. * @param $edit - * Relevant post data for real value, or NULL for default value + * The incoming POST data to populate the form element. If this is FALSE, + * the element's default value should be returned. * @return - * Mixed, value to be assigned to element. + * The data that will appear in the $form_state['values'] collection + * for this element. Return nothing to use the default. */ -function form_type_select_value($form, $edit = NULL) { - if (isset($edit)) { +function form_type_select_value($form, $edit = FALSE) { + if ($edit !== FALSE) { if (isset($form['#multiple']) && $form['#multiple']) { return (is_array($edit)) ? drupal_map_assoc($edit) : array(); } @@ -957,14 +965,16 @@ function form_type_select_value($form, $ * Helper function to determine the value for a textfield form element. * * @param $form - * Form element we are trying to determine a value for. + * The form element whose value is being populated. * @param $edit - * Relevant post data for real value, or NULL for default value + * The incoming POST data to populate the form element. If this is FALSE, + * the element's default value should be returned. * @return - * Mixed, value to be assigned to element. + * The data that will appear in the $form_state['values'] collection + * for this element. Return nothing to use the default. */ -function form_type_textfield_value($form, $edit = NULL) { - if (isset($edit)) { +function form_type_textfield_value($form, $edit = FALSE) { + if ($edit !== FALSE) { // Equate $edit to the form value to ensure it's marked for // validation. return str_replace(array("\r", "\n"), '', $edit); @@ -975,14 +985,16 @@ function form_type_textfield_value($form * Helper function to determine the value for form's token value. * * @param $form - * Form element we are trying to determine a value for. + * The form element whose value is being populated. * @param $edit - * Relevant post data for real value, or NULL for default value + * The incoming POST data to populate the form element. If this is FALSE, + * the element's default value should be returned. * @return - * Mixed, value to be assigned to element. + * The data that will appear in the $form_state['values'] collection + * for this element. Return nothing to use the default. */ -function form_type_token_value($form, $edit = NULL) { - if (isset($edit)) { +function form_type_token_value($form, $edit = FALSE) { + if ($edit !== FALSE) { return (string)$edit; } }