1 form_test.module form_test_storage_legacy_handler($form_build_id)

Emulate legacy AHAH-style ajax callback.

Drupal 6 AHAH callbacks used to operate directly on forms retrieved using form_get_cache and stored using form_set_cache after manipulation. This callback helps testing whether form_set_cache prevents resaving of immutable forms.

File

core/modules/simpletest/tests/form_test.module, line 903
Helper module for the Form API tests.

Code

function form_test_storage_legacy_handler($form_build_id) {
  $form_state = array();
  $form = form_get_cache($form_build_id, $form_state);

  backdrop_json_output(array(
    'form' => $form,
    'form_state' => $form_state,
  ));

  $form['#poisoned'] = TRUE;
  $form_state['poisoned'] = TRUE;

  form_set_cache($form_build_id, $form, $form_state);

  // This exit call is necessary for a "legacy" handler, otherwise Backdrop will
  // append AJAX commands for settings to the already-printed JSON string.
  backdrop_exit();
}