function agrcache_aggregate_css in Aggregate cache 7
Replacement for drupal_aggregate_css().
1 string reference to 'agrcache_aggregate_css'
- agrcache_element_info_alter in ./
agrcache.module - Implements hook_element_info_alter().
File
- ./
agrcache.module, line 236 - Provides imagecache style generation of css/js aggregates.
Code
function agrcache_aggregate_css(&$css_groups) {
$preprocess_css = variable_get('preprocess_css', FALSE) && (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update');
$map = array();
// For each group that needs aggregation, aggregate its items.
foreach ($css_groups as $key => $group) {
switch ($group['type']) {
// If a file group can be aggregated into a single file, do so, and set
// the group's data property to the file path of the aggregate file.
case 'file':
if ($group['preprocess'] && $preprocess_css) {
$data = agrcache_build_aggregate_cache($group['items'], 'css');
if ($data) {
$css_groups[$key]['data'] = $data['uri'];
if (!empty($data['#write_cache'])) {
$map['files'][$data['key']] = $data['uri'];
$map['callbacks'][$data['uri']] = $group['items'];
}
}
}
break;
// Aggregate all inline CSS content into the group's data property.
case 'inline':
$css_groups[$key]['data'] = '';
foreach ($group['items'] as $item) {
$css_groups[$key]['data'] .= drupal_load_stylesheet_content($item['data'], $item['preprocess']);
}
break;
}
}
if (!empty($map)) {
agrcache_update_file_list('css', $map);
}
}