diff --git a/plugins/views_plugin_cache.inc b/plugins/views_plugin_cache.inc index 4d21701..e478f8c 100644 --- a/plugins/views_plugin_cache.inc +++ b/plugins/views_plugin_cache.inc @@ -203,19 +203,31 @@ class views_plugin_cache extends views_plugin { // Slightly less simple for CSS: $css = drupal_add_css(); $css_start = isset($this->storage['css']) ? $this->storage['css'] : array(); - $this->storage['css'] = array_diff_assoc($css, $css_start); + $diff = drupal_array_diff_assoc_recursive($css, $css_start); + // Reset storage and for every difference add the complete original element + $this->storage['css'] = array(); + foreach ($diff as $key => $value) { + $this->storage['css'][$key] = $css[$key]; + } // Get javascript after/before views renders. $js = drupal_add_js(); $js_start = isset($this->storage['js']) ? $this->storage['js'] : array(); // If there are any differences between the old and the new javascript then // store them to be added later. - $this->storage['js'] = array_diff_assoc($js, $js_start); - - // Special case the settings key and get the difference of the data. - $settings = isset($js['settings']['data']) ? $js['settings']['data'] : array(); - $settings_start = isset($js_start['settings']['data']) ? $js_start['settings']['data'] : array(); - $this->storage['js']['settings'] = array_diff_assoc($settings, $settings_start); + $diff = drupal_array_diff_assoc_recursive($js, $js_start); + // Reset storage and for every difference add the complete original element + $this->storage['js'] = array(); + foreach ($diff as $key => $value) { + // Special case for settings where we only want to add differing settings + if ($key == 'settings' && isset($value['data'])) { + foreach ($value['data'] as $setting => $setting_value) { + $this->storage['js']['settings'][$setting] = $setting_value; + } + } else { + $this->storage['js'][$key] = $js[$key]; + } + } // Get difference of HTTP headers. $this->storage['headers'] = array_diff_assoc(drupal_get_http_header(), $this->storage['headers']);