function _form_set_value

6.x form.inc _form_set_value(&$form_values, $form_item, $parents, $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 drupal-6.x/includes/form.inc
Change submitted form values during the form processing cycle.

File

drupal-6.x/includes/form.inc, line 1348

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);
  }
}