function _prepopulate_get_walk in Prepopulate 6
Same name and namespace in other branches
- 5 prepopulate.module \_prepopulate_get_walk()
Internal helper to set element values from the $_GET variable.
Parameters
&$form: Array. A form element.
&$getslice: String or array. Value(s) to be applied to the element.
1 call to _prepopulate_get_walk()
- prepopulate_form_alter in ./
prepopulate.module - Implementation of hook_form_alter().
File
- ./
prepopulate.module, line 44 - Fill form elements with data from GET values.
Code
function _prepopulate_get_walk(&$form, &$getslice) {
if (is_array($getslice)) {
if (!is_null($form['#default_value'])) {
if (!is_array($form['#default_value'])) {
// Something went wrong so stop here.
return;
}
$form['#default_value'] = array_merge($form['#default_value'], $getslice);
}
else {
foreach (array_keys($getslice) as $getvar) {
if (element_child($getvar) && is_array($form) && !is_null($form[$getvar])) {
_prepopulate_get_walk($form[$getvar], $getslice[$getvar]);
}
}
}
}
else {
$form['#default_value'] = $getslice;
}
}