Menu callback: Returns an AjaxResponse; settings command set last.
Helps verifying AjaxResponse reorders commands to ensure correct execution.
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;
}