summaryrefslogtreecommitdiff
path: root/includes/ajax.inc
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2011-10-29 12:50:43 -0700
committerwebchick <webchick@24967.no-reply.drupal.org>2011-10-29 12:50:43 -0700
commit7ad0db1015aad9ae457290b5b31867f990643de4 (patch)
tree268f4f601fa77a535679fa73c6d3a12f7b72edbc /includes/ajax.inc
parent33e476a1fdabb335e2bc8d9869d5a770460b3b55 (diff)
downloadbrdo-7ad0db1015aad9ae457290b5b31867f990643de4.tar.gz
brdo-7ad0db1015aad9ae457290b5b31867f990643de4.tar.bz2
Issue #561858 follow-up by effulgentsia, sun: Add tests for AJAX framework lazy-load feature.
Diffstat (limited to 'includes/ajax.inc')
-rw-r--r--includes/ajax.inc17
1 files changed, 5 insertions, 12 deletions
diff --git a/includes/ajax.inc b/includes/ajax.inc
index d70808efe..cda55b424 100644
--- a/includes/ajax.inc
+++ b/includes/ajax.inc
@@ -262,19 +262,13 @@ function ajax_render($commands = array()) {
}
}
- // Settings are handled separately, later in this function, so that changes to
- // the ajaxPageState setting that occur during drupal_get_css() and
- // drupal_get_js() get included, and because the jQuery.extend() code produced
- // by drupal_get_js() for adding settings isn't appropriate during an Ajax
- // response, because it does not pass TRUE for the "deep" parameter, and
- // therefore, can clobber existing settings on the page.
+ // Render the HTML to load these files, and add AJAX commands to insert this
+ // HTML in the page. We pass TRUE as the $skip_alter argument to prevent the
+ // data from being altered again, as we already altered it above. Settings are
+ // handled separately, afterwards.
if (isset($items['js']['settings'])) {
unset($items['js']['settings']);
}
-
- // Render the HTML to load these files, and add Ajax commands to insert this
- // HTML in the page. We pass TRUE as the $skip_alter argument to prevent the
- // data from being altered again, as we already altered it above.
$styles = drupal_get_css($items['css'], TRUE);
$scripts_footer = drupal_get_js('footer', $items['js'], TRUE);
$scripts_header = drupal_get_js('header', $items['js'], TRUE);
@@ -293,11 +287,10 @@ function ajax_render($commands = array()) {
$commands = array_merge($extra_commands, $commands);
}
+ // Now add a command to merge changes and additions to Drupal.settings.
$scripts = drupal_add_js();
if (!empty($scripts['settings'])) {
$settings = $scripts['settings'];
- // Automatically extract any settings added via drupal_add_js() and make
- // them the first command.
array_unshift($commands, ajax_command_settings(call_user_func_array('array_merge_recursive', $settings['data']), TRUE));
}