function _cdn_aggregate_css in CDN 7.2
Near-identical to Changes: call _cdn_build_css_cache() instead of drupal_build_css_cache().
See also
1 string reference to '_cdn_aggregate_css'
- cdn_element_info_alter in ./
cdn.module - Implements hook_element_info_alter().
File
- ./
cdn.basic.css.inc, line 16 - Overrides of Drupal's CSS aggregation system. Ensures that files referenced by CSS files are also served from the CDN, according to the CDN module's CSS aggregation rules.
Code
function _cdn_aggregate_css(&$css_groups) {
// Don't override Drupal core's aggregation if this page is not going to use
// a CDN anyway.
if (!cdn_check_protocol() && !cdn_check_drupal_path($_GET['q'])) {
return;
}
$preprocess_css = variable_get('preprocess_css', FALSE) && (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update');
// 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 ($preprocess_css) {
if ($group['preprocess']) {
$css_groups[$key]['data'] = _cdn_build_css_cache($group['items']);
}
else {
$suffix = '';
if (count($group['items']) == 1) {
$suffix .= '_' . basename($group['items'][0]['data']);
}
$css_groups[$key]['data'] = _cdn_build_css_cache($group['items'], $suffix);
}
}
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;
}
}
}