summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-03-03 08:43:07 +0000
committerDries Buytaert <dries@buytaert.net>2010-03-03 08:43:07 +0000
commit02d6b122b5d9d92572812ee782aa0730849bf1d1 (patch)
treec2b052966f266d18941fae3644b99964f869332d
parentc4fd5818999670bf754c24a88fc718e6b502a85b (diff)
downloadbrdo-02d6b122b5d9d92572812ee782aa0730849bf1d1.tar.gz
brdo-02d6b122b5d9d92572812ee782aa0730849bf1d1.tar.bz2
- Patch #648170 by fago, sun: form constructors cannot enable form caching or form rebuilding.
-rw-r--r--includes/form.inc7
-rw-r--r--modules/simpletest/tests/form_test.module11
2 files changed, 7 insertions, 11 deletions
diff --git a/includes/form.inc b/includes/form.inc
index 9875c1b0a..0955dfd0f 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -328,9 +328,8 @@ function drupal_rebuild_form($form_id, &$form_state, $form_build_id = NULL) {
drupal_prepare_form($form_id, $form, $form_state);
if (empty($form_state['no_cache'])) {
- // We cache the form structure so it can be retrieved later for validation.
- // If $form_state['storage'] is populated, we also cache it so that it can
- // be used to resume complex multi-step processes.
+ // We cache the form structure and the form state so it can be retrieved
+ // later for validation.
form_set_cache($form_build_id, $form, $form_state);
}
@@ -396,8 +395,6 @@ function form_state_keys_no_cache() {
return array(
// Public properties defined by form constructors and form handlers.
'always_process',
- 'cache',
- 'no_cache',
'must_validate',
'rebuild',
'redirect',
diff --git a/modules/simpletest/tests/form_test.module b/modules/simpletest/tests/form_test.module
index 54b6299f8..691657786 100644
--- a/modules/simpletest/tests/form_test.module
+++ b/modules/simpletest/tests/form_test.module
@@ -144,6 +144,11 @@ function form_test_validate_form($form, &$form_state) {
'#type' => 'submit',
'#value' => 'Save',
);
+
+ // To simplify this test, enable form caching and use form storage to
+ // remember our alteration.
+ $form_state['cache'] = TRUE;
+
return $form;
}
@@ -161,9 +166,6 @@ function form_test_element_validate_name(&$element, &$form_state) {
$triggered = TRUE;
}
if ($form_state['values']['name'] == 'element_validate_access') {
- // To simplify this test, enable form caching and use form storage to
- // remember our alteration.
- $form_state['cache'] = TRUE;
$form_state['storage']['form_test_name'] = $form_state['values']['name'];
// Alter the form element.
$element['#access'] = FALSE;
@@ -453,9 +455,6 @@ function form_test_storage_element_validate_value_cached($element, &$form_state)
// though.
if (isset($_REQUEST['cache']) && $form_state['values']['value'] == 'change_title') {
$form_state['storage']['thing']['changed'] = TRUE;
- // @todo Fix FAPI to make it unnecessary to explicitly set the cache flag in
- // this situation. @see http://drupal.org/node/641356.
- $form_state['cache'] = TRUE;
}
}