diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-10-04 17:46:01 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-10-04 17:46:01 +0000 |
commit | 5a23b3fdb970bb0c3e79f47ba9296455d237d9f0 (patch) | |
tree | b9e59f7bdb1ffbbdc569c34f56980aba267ca3fa /modules/simpletest/tests/ajax_forms_test.module | |
parent | a50d47f9591d240f212b66332e25d7f2ce50369d (diff) | |
download | brdo-5a23b3fdb970bb0c3e79f47ba9296455d237d9f0.tar.gz brdo-5a23b3fdb970bb0c3e79f47ba9296455d237d9f0.tar.bz2 |
- Patch #561858 by effulgentsia, sun, rfay, Nick_vh, merlinofchaos, katbailey, dereine, tstoeckler: drupal_add_js() and drupal_add_css() to work for AJAX requests too by adding lazy-load to AJAX framework.
Diffstat (limited to 'modules/simpletest/tests/ajax_forms_test.module')
-rw-r--r-- | modules/simpletest/tests/ajax_forms_test.module | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/modules/simpletest/tests/ajax_forms_test.module b/modules/simpletest/tests/ajax_forms_test.module index fa23acda8..531c703fd 100644 --- a/modules/simpletest/tests/ajax_forms_test.module +++ b/modules/simpletest/tests/ajax_forms_test.module @@ -217,7 +217,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { '#suffix' => '<div id="remove_div"><div id="remove_text">text to be removed</div></div>', ); - // Show off the AJAX 'restripe' command. + // Shows the AJAX 'restripe' command. $form['restripe_command_example'] = array( '#type' => 'submit', '#value' => t("AJAX 'restripe' command"), @@ -230,8 +230,17 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) { <tr ><td>second row</td></tr> </table> </div>', + ); - + // Demonstrates the AJAX 'settings' command. The 'settings' command has + // nothing visual to "show", but it can be tested via SimpleTest and via + // Firebug. + $form['settings_command_example'] = array( + '#type' => 'submit', + '#value' => t("AJAX 'settings' command"), + '#ajax' => array( + 'callback' => 'ajax_forms_test_advanced_commands_settings_callback', + ), ); $form['submit'] = array( @@ -367,7 +376,15 @@ function ajax_forms_test_advanced_commands_restripe_callback($form, $form_state) return array('#type' => 'ajax', '#commands' => $commands); } - +/** + * AJAX callback for 'settings'. + */ +function ajax_forms_test_advanced_commands_settings_callback($form, $form_state) { + $commands = array(); + $setting['ajax_forms_test']['foo'] = 42; + $commands[] = ajax_command_settings($setting); + return array('#type' => 'ajax', '#commands' => $commands); +} /** * This form and its related submit and callback functions demonstrate |