function views_plugin_cache::gather_headers
Same name in other branches
- 7.x-3.x plugins/views_plugin_cache.inc \views_plugin_cache::gather_headers()
Gather out of band data, compare it to what we started with and store the difference.
1 call to views_plugin_cache::gather_headers()
- views_plugin_cache::cache_set in plugins/
views_plugin_cache.inc - Save data to the cache.
File
-
plugins/
views_plugin_cache.inc, line 191
Class
- views_plugin_cache
- The base plugin to handle caching.
Code
function gather_headers() {
// Simple replacement for head
$this->storage['head'] = str_replace($this->storage['head'], '', drupal_set_html_head());
// Slightly less simple for CSS:
$css = drupal_add_css();
$start = $this->storage['css'];
$this->storage['css'] = array();
foreach ($css as $media => $medias) {
foreach ($medias as $type => $types) {
foreach ($types as $path => $preprocess) {
if (!isset($start[$media][$type][$path])) {
$this->storage['css'][] = array(
$path,
$type,
$media,
$preprocess,
);
}
}
}
}
$js = array();
// A little less simple for js
foreach (array(
'header',
'footer',
) as $scope) {
$js[$scope] = drupal_add_js(NULL, NULL, $scope);
}
$start = $this->storage['js'];
$this->storage['js'] = array();
foreach ($js as $scope => $scopes) {
foreach ($scopes as $type => $types) {
foreach ($types as $id => $info) {
if (!isset($start[$scope][$type][$id])) {
switch ($type) {
case 'setting':
$this->storage['js'][] = array(
$info,
$type,
$scope,
);
break;
case 'inline':
$this->storage['js'][] = array(
$info['code'],
$type,
$scope,
$info['defer'],
);
break;
default:
$this->storage['js'][] = array(
$id,
$type,
$scope,
$info['defer'],
$info['cache'],
);
}
}
}
}
}
}