diff --git a/includes/form.inc b/includes/form.inc index c29116f257c035638baed5f542808f929f3b1da8..58b423c0802e2a503a10f6d24859d2b7937d07c8 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -63,8 +63,7 @@ function drupal_get_form($form_id, &$form, $callback = NULL) { variable_set('drupal_private_key', mt_rand()); } - $form['form_token'] = array('#type' => 'hidden', '#value' => md5($_SERVER['REMOTE_ADDR'] . $form['#token'] . variable_get('drupal_private_key', -''))); + $form['form_token'] = array('#type' => 'hidden', '#value' => md5($_SERVER['REMOTE_ADDR'] . $form['#token'] . variable_get('drupal_private_key', ''))); } $form['form_id'] = array('#type' => 'hidden', '#default_value' => $form_id); @@ -286,20 +285,8 @@ function _form_builder($form_id, $form) { // don't squash existing parents value if (!isset($form[$key]['#parents'])) { - if ($form[$key]['#tree']) { - if (!$form['#tree']) { - // begin tree - $form[$key]['#parents'] = array($key); - } - else { - //continue tree - $form[$key]['#parents'] = array_merge($form['#parents'], array($key)); - } - } - else { - // no tree - $form[$key]['#parents'] = array($key); - } + // Check to see if a tree of child elements is present. If so, continue down the tree if required. + $form[$key]['#parents'] = $form[$key]['#tree'] && $form['#tree'] ? array_merge($form['#parents'], array($key)) : array($key); } # Assign a decimal placeholder weight, to preserve original array order