You are here

function _form_set_value in Drupal 6

Same name and namespace in other branches
  1. 4 includes/form.inc \_form_set_value()
  2. 5 includes/form.inc \_form_set_value()

Helper function for form_set_value().

We iterate over $parents and create nested arrays for them in $form_state['values'] if needed. Then we insert the value into the right array.

Related topics

1 call to _form_set_value()
form_set_value in includes/form.inc
Change submitted form values during the form processing cycle.

File

includes/form.inc, line 1426

Code

function _form_set_value(&$form_values, $form_item, $parents, $value) {
  $parent = array_shift($parents);
  if (empty($parents)) {
    $form_values[$parent] = $value;
  }
  else {
    if (!isset($form_values[$parent])) {
      $form_values[$parent] = array();
    }
    _form_set_value($form_values[$parent], $form_item, $parents, $value);
  }
}