Commit 0ca44db1 authored by Dries's avatar Dries

- Patch #1591726 by sun: missing form_id(), form_build_id(), and form_token()...

- Patch #1591726 by sun: missing form_id(), form_build_id(), and form_token() when using custom #parents and #tree = TRUE on  itself.
parent ae42df87
......@@ -987,6 +987,10 @@ function drupal_prepare_form($form_id, &$form, &$form_state) {
'#value' => $form['#build_id'],
'#id' => $form['#build_id'],
'#name' => 'form_build_id',
// Form processing and validation requires this value, so ensure the
// submitted form value appears literally, regardless of custom #tree
// and #parents being set elsewhere.
'#parents' => array('form_build_id'),
);
// Add a token, based on either #token or form_id, to any form displayed to
......@@ -1010,6 +1014,10 @@ function drupal_prepare_form($form_id, &$form, &$form_state) {
'#id' => drupal_html_id('edit-' . $form_id . '-form-token'),
'#type' => 'token',
'#default_value' => drupal_get_token($form['#token']),
// Form processing and validation requires this value, so ensure the
// submitted form value appears literally, regardless of custom #tree
// and #parents being set elsewhere.
'#parents' => array('form_token'),
);
}
}
......@@ -1019,6 +1027,10 @@ function drupal_prepare_form($form_id, &$form, &$form_state) {
'#type' => 'hidden',
'#value' => $form_id,
'#id' => drupal_html_id("edit-$form_id"),
// Form processing and validation requires this value, so ensure the
// submitted form value appears literally, regardless of custom #tree
// and #parents being set elsewhere.
'#parents' => array('form_id'),
);
}
if (!isset($form['#id'])) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment