diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/book/book.module | 9 | ||||
-rw-r--r-- | modules/book/book.pages.inc | 2 | ||||
-rw-r--r-- | modules/poll/poll.module | 12 | ||||
-rw-r--r-- | modules/simpletest/tests/form.test | 2 | ||||
-rw-r--r-- | modules/simpletest/tests/form_test.module | 2 | ||||
-rw-r--r-- | modules/upload/upload.module | 10 |
6 files changed, 17 insertions, 20 deletions
diff --git a/modules/book/book.module b/modules/book/book.module index 08abba08a..9c0778b89 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -360,8 +360,7 @@ function book_get_books() { * @see book_pick_book_submit() * @see book_submit() */ -function book_form_alter(&$form, $form_state, $form_id) { - +function book_form_alter(&$form, &$form_state, $form_id) { if (!empty($form['#node_edit_form'])) { // Add elements to the node form. $node = $form['#node']; @@ -375,7 +374,7 @@ function book_form_alter(&$form, $form_state, $form_id) { } if ($access) { - _book_add_form_elements($form, $node); + _book_add_form_elements($form, $form_state, $node); $form['book']['pick-book'] = array( '#type' => 'submit', '#value' => t('Change book (update list of parents)'), @@ -439,9 +438,9 @@ function _book_parent_select($book_link) { /** * Build the common elements of the book form for the node and outline forms. */ -function _book_add_form_elements(&$form, $node) { +function _book_add_form_elements(&$form, &$form_state, $node) { // Need this for AJAX. - $form['#cache'] = TRUE; + $form_state['cache'] = TRUE; $form['book'] = array( '#type' => 'fieldset', diff --git a/modules/book/book.pages.inc b/modules/book/book.pages.inc index 1e360ab8c..76454aa9f 100644 --- a/modules/book/book.pages.inc +++ b/modules/book/book.pages.inc @@ -117,7 +117,7 @@ function book_outline_form($form, &$form_state, $node) { } $form['#node'] = $node; $form['#id'] = 'book-outline'; - _book_add_form_elements($form, $node); + _book_add_form_elements($form, $form_state, $node); $form['book']['#collapsible'] = FALSE; diff --git a/modules/poll/poll.module b/modules/poll/poll.module index 9242bcf9f..18be700f2 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -211,16 +211,14 @@ function poll_field_extra_fields($bundle) { /** * Implement hook_form(). */ -function poll_form($node, $form_state) { +function poll_form($node, &$form_state) { global $user; $admin = user_access('administer nodes') || user_access('edit any poll content') || (user_access('edit own poll content') && $user->uid == $node->uid); $type = node_type_get_type($node); - $form = array( - '#cache' => TRUE, - ); + $form_state['cache'] = TRUE; if (isset($form_state['choice_count'])) { $choice_count = $form_state['choice_count']; @@ -658,7 +656,7 @@ function poll_view_voting($form, &$form_state, $node, $block = FALSE) { // Set form caching because we could have multiple of these forms on // the same page, and we want to ensure the right one gets picked. - $form['#cache'] = TRUE; + $form_state['cache'] = TRUE; // Provide a more cleanly named voting form theme. $form['#theme'] = 'poll_vote'; @@ -845,6 +843,8 @@ function template_preprocess_poll_bar(&$variables) { * @see poll_cancel() */ function poll_cancel_form($form, &$form_state, $nid) { + $form_state['cache'] = TRUE; + // Store the nid so we can get to it in submit functions. $form['#nid'] = $nid; @@ -854,8 +854,6 @@ function poll_cancel_form($form, &$form_state, $nid) { '#submit' => array('poll_cancel') ); - $form['#cache'] = TRUE; - return $form; } diff --git a/modules/simpletest/tests/form.test b/modules/simpletest/tests/form.test index 895084f6b..ed556c540 100644 --- a/modules/simpletest/tests/form.test +++ b/modules/simpletest/tests/form.test @@ -432,7 +432,7 @@ class FormsFormStorageTestCase extends DrupalWebTestCase { } /** - * Tests using the form with an activated #cache property. + * Tests using the form with an activated $form_state['cache'] property. */ function testFormCached() { $user = $this->drupalCreateUser(array('access content')); diff --git a/modules/simpletest/tests/form_test.module b/modules/simpletest/tests/form_test.module index efd26b773..5e420fc4a 100644 --- a/modules/simpletest/tests/form_test.module +++ b/modules/simpletest/tests/form_test.module @@ -329,7 +329,7 @@ function form_storage_test_form($form, &$form_state) { if (isset($_REQUEST['cache'])) { // Manually activate caching, so we can test that the storage keeps working // when it's enabled. - $form['#cache'] = TRUE; + $form_state['cache'] = TRUE; } return $form; diff --git a/modules/upload/upload.module b/modules/upload/upload.module index 93162c5ca..fb5341f21 100644 --- a/modules/upload/upload.module +++ b/modules/upload/upload.module @@ -210,7 +210,7 @@ function upload_node_form_submit(&$form, &$form_state) { } } -function upload_form_alter(&$form, $form_state, $form_id) { +function upload_form_alter(&$form, &$form_state, $form_id) { if ($form_id == 'node_type_form' && isset($form['identity']['type'])) { $form['workflow']['upload'] = array( '#type' => 'radios', @@ -256,7 +256,7 @@ function upload_form_alter(&$form, $form_state, $form_id) { } } else { - $form['attachments']['wrapper'] += _upload_form($node); + $form['attachments']['wrapper'] += _upload_form($node, $form_state); } $form['#submit'][] = 'upload_node_form_submit'; } @@ -529,12 +529,12 @@ function upload_save($node) { } } -function _upload_form($node) { +function _upload_form($node, &$form_state) { global $user; + $form_state['cache'] = TRUE; $form = array( '#theme' => 'upload_form_new', - '#cache' => TRUE, '#prefix' => '<div id="attach-wrapper">', '#suffix' => '</div>', ); @@ -669,7 +669,7 @@ function upload_js() { $node->files = $files; - $form = _upload_form($node); + $form = _upload_form($node, $form_state); unset($cached_form['attachments']['wrapper']['new']); $cached_form['attachments']['wrapper'] = array_merge($cached_form['attachments']['wrapper'], $form); |