function ajax_test_order

Menu callback: Returns an AjaxResponse; settings command set last.

Helps verifying AjaxResponse reorders commands to ensure correct execution.

1 string reference to 'ajax_test_order'
ajax_test_menu in drupal/core/modules/system/tests/modules/ajax_test/ajax_test.module
Implements hook_menu().

File

drupal/core/modules/system/tests/modules/ajax_test/ajax_test.module, line 78
Helper module for Ajax framework tests.

Code

function ajax_test_order() {
  $response = new AjaxResponse();
  $path = drupal_get_path('module', 'system');

  // HTML insertion command.
  $response
    ->addCommand(new HtmlCommand('body', 'Hello, world!'));

  // Add two CSS files (order should remain the same).
  drupal_add_css($path . '/css/system.admin.css');
  drupal_add_css($path . '/css/system.maintenance.css');

  // Add two JavaScript files (first to the footer, should appear last).
  drupal_add_js($path . '/system.modules.js', array(
    'scope' => 'footer',
  ));
  drupal_add_js($path . '/system.js');

  // Finally, add a JavaScript setting.
  drupal_add_js(array(
    'ajax' => 'test',
  ), 'setting');
  return $response;
}