function _form_repopulate in Module Builder 7
Same name and namespace in other branches
- 6.2 includes/module_builder.pages.inc \_form_repopulate()
- 7.2 includes/module_builder.pages.inc \_form_repopulate()
Repopulate form with user values.
1 call to _form_repopulate()
- module_builder_page_input in includes/
module_builder.pages.inc
File
- includes/
module_builder.pages.inc, line 252 - Menu callback for main module builder page.
Code
function _form_repopulate($form, $form_state) {
#dsm($form);
#dsm(element_children($form));
#dsm($form_state);
foreach (element_children($form) as $key) {
if (isset($form[$key]['#repopulate'])) {
#dsm('repop: ');
#dsm($key);
#$form[$key]['#default_value'] = 'repop!'; // this obviously works
#$form[$key]['#default_value'] = $form_state['values'][$key]; // arg! here we only have values from page 2!
$form[$key]['#default_value'] = $form_state['storage']['input'][$key];
// this obviously works
}
// recurse into children
$form[$key] = _form_repopulate($form[$key], $form_state);
}
// each element_children
return $form;
}