You are here

function ajax_test_render in SimpleTest 7

Menu callback; Copies $_GET['commands'] into $commands and ajax_render()s that.

Additionally ensures that ajax_render() incorporates JavaScript settings by invoking drupal_add_js() with a dummy setting.

1 string reference to 'ajax_test_render'
ajax_test_menu in tests/ajax_test.module
Implement hook_menu().

File

tests/ajax_test.module, line 33
Helper module for AJAX framework tests.

Code

function ajax_test_render() {

  // Prepare AJAX commands.
  $commands = array();
  if (!empty($_GET['commands'])) {
    $commands = $_GET['commands'];
  }

  // Add a dummy JS setting.
  drupal_add_js(array(
    'ajax' => 'test',
  ), 'setting');

  // Output AJAX commands and end the request.
  ajax_render($commands);
}