Implements hook_advagg_get_css_aggregate_contents_alter().

Related topics

File

advagg_css_compress/advagg_css_compress.advagg.inc, line 33

Code

function advagg_css_compress_advagg_get_css_aggregate_contents_alter(&$data, $files, $aggregate_settings) {
    // Get per file settings.
    foreach ($files as $filename => $settings) {
        if (!empty($aggregate_settings['variables']['advagg_css_compressor_file_settings'])) {
            $form_api_filename = str_replace(array(
                '/',
                '.',
            ), array(
                '__',
                '--',
            ), $filename);
            if (isset($aggregate_settings['variables']['advagg_css_compressor_file_settings'][$form_api_filename])) {
                $aggregate_settings['variables']['advagg_css_compressor'] = $aggregate_settings['variables']['advagg_css_compressor_file_settings'][$form_api_filename];
                // If one file can not be compressed then the whole aggregrate can not
                // be compressed.
                if ($aggregate_settings['variables']['advagg_css_compressor'] == 0) {
                    break;
                }
            }
        }
    }
    // Do nothing if the compressor is disabled.
    if (empty($aggregate_settings['variables']['advagg_css_compressor'])) {
        return;
    }
    // Do nothing if the cache settings are set to Development.
    if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 0) {
        return;
    }
    list(, , , $functions) = advagg_css_compress_configuration();
    if (isset($functions[$aggregate_settings['variables']['advagg_css_compressor']])) {
        $run = $functions[$aggregate_settings['variables']['advagg_css_compressor']];
        if (function_exists($run)) {
            $functions[$aggregate_settings['variables']['advagg_css_compressor']]($data);
        }
    }
}