You are here

function comment_upload_value_to_default in Comment Upload 6

Traverse a build form and copy #value to corresponding #default_values in an unbuild form.

Parameters

array $build_form:

array $form:

1 call to comment_upload_value_to_default()
comment_upload_alter_comment_form in ./comment_upload.module
Alter the comment form to support AHAH uploads.

File

./comment_upload.module, line 272
Provides file attachment functionality for comments.

Code

function comment_upload_value_to_default($build_form, &$form) {
  if (!is_array($build_form)) {
    return;
  }
  foreach (element_children($build_form) as $key) {
    if (isset($form[$key]) && isset($build_form[$key]['#value'])) {
      $form[$key]['#default_value'] = $build_form[$key]['#value'];
    }
    comment_upload_value_to_default($build_form[$key], $form[$key]);
  }
}