You are here

function _prepopulate_get_walk in Prepopulate 5

Same name and namespace in other branches
  1. 6 prepopulate.module \_prepopulate_get_walk()

Internal helper to get variables from the $_GET.

1 call to _prepopulate_get_walk()
prepopulate_after_build in ./prepopulate.module
Implementation of prepopulate_after_build().

File

./prepopulate.module, line 55
Fill form elements with data from GET.

Code

function _prepopulate_get_walk(&$form, &$getslice) {
  if (!is_array($getslice)) {
    $form['#default_value'] = $getslice;
  }
  else {
    foreach (array_keys($getslice) as $getvar) {
      if (element_child($getvar) && is_array($form) && !is_null($form[$getvar]) && $form[$getvar]['#type'] != "value") {
        if (!isset($form[$getvar]['#access']) || $form[$getvar]['#access'] != FALSE) {
          _prepopulate_get_walk($form[$getvar], $getslice[$getvar]);
        }
      }
    }

    // endforeach walking through get
  }

  // endif getslice is not an array
}