summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2012-02-14 15:17:20 -0500
committerwebchick <webchick@24967.no-reply.drupal.org>2012-02-14 15:17:20 -0500
commit74b7b4466c62a18d6140b273208d5d332602410a (patch)
tree68f19f1f9646487dcd530e76115dec77e4ca9e9c /includes
parent936c3331c155103875d2f4b3fb80785b366d0d6e (diff)
downloadbrdo-74b7b4466c62a18d6140b273208d5d332602410a.tar.gz
brdo-74b7b4466c62a18d6140b273208d5d332602410a.tar.bz2
Issue #1287368 by TwoD, valthebald, sun, xjm: Fixed Drupal.settings.ajaxPageState.css gets overwritten.
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc9
1 files changed, 7 insertions, 2 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 43e211813..d799616d4 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -2991,8 +2991,13 @@ function drupal_get_css($css = NULL, $skip_alter = FALSE) {
// Provide the page with information about the individual CSS files used,
// information not otherwise available when CSS aggregation is enabled.
- $setting['ajaxPageState']['css'] = array_fill_keys(array_keys($css), 1);
- $styles['#attached']['js'][] = array('type' => 'setting', 'data' => $setting);
+ // Skip if no files were added to the page or jQuery.extend() will overwrite
+ // the Drupal.settings.ajaxPageState.css object with an empty array.
+ // Cast the array to an object to be on the safe side even if not empty.
+ if (!empty($css)) {
+ $setting['ajaxPageState']['css'] = (object) array_fill_keys(array_keys($css), 1);
+ $styles['#attached']['js'][] = array('type' => 'setting', 'data' => $setting);
+ }
return drupal_render($styles);
}