$types) { // If CSS preprocessing is off, we still need to output the styles. // Additionally, go through any remaining styles if CSS preprocessing is on and output the non-cached ones. foreach ($types as $type => $files) { if ($type == 'module') { // Setup theme overrides for module styles. $theme_styles = array(); foreach (array_keys($css[$media]['theme']) as $theme_style) { $theme_styles[] = basename($theme_style); } } foreach ($types[$type] as $file => $preprocess) { // If the theme supplies its own style using the name of the module style, skip its inclusion. // This includes any RTL styles associated with its main LTR counterpart. if ($type == 'module' && in_array(str_replace('-rtl.css', '.css', basename($file)), $theme_styles)) { // Unset the file to prevent its inclusion when CSS aggregation is enabled. unset($types[$type][$file]); continue; } // Only include the stylesheet if it exists. if (file_exists($file)) { if (!$preprocess || !($is_writable && $preprocess_css)) { // If a CSS file is not to be preprocessed and it's a module CSS file, it needs to *always* appear at the *top*, // regardless of whether preprocessing is on or off. if (!$preprocess && $type == 'module') { $no_module_preprocess[] = array($media, base_path() . $file . $query_string); // $no_module_preprocess .= ''."\n"; } // If a CSS file is not to be preprocessed and it's a theme CSS file, it needs to *always* appear at the *bottom*, // regardless of whether preprocessing is on or off. else if (!$preprocess && $type == 'theme') { $no_theme_preprocess[] = array($media, base_path() . $file . $query_string); // $no_theme_preprocess .= ''."\n"; } else { $output[] = array($media, base_path() . $file . $query_string); // $output .= ''."\n"; } } } } } if ($is_writable && $preprocess_css) { // Prefix filename to prevent blocking by firewalls which reject files // starting with "ad*". $filename = 'css_'. md5(serialize($types) . $query_string) .'.css'; $preprocess_file = drupal_build_css_cache($types, $filename); $output[] = array($media, base_path() . $preprocess_file); // $output .= ''."\n"; } } $files = array_merge($no_module_preprocess, $output, $no_theme_preprocess); $styles = ''; if (count($files) < 22) { // traditional method. foreach ($files as $css_file) { list ($media, $href) = $css_file; $styles .= ''."\n"; } } else { // import method $counter = 0; $media = NULL; $import = ''; foreach ($files as $css_file) { list ($media_new, $href) = $css_file; if ($media_new != $media || $counter > 25) { if ($media && !empty($import)) { $styles .= "\n".''; $import = ''; } $counter = 0; $media = $media_new; } $import .= '@import "'. $href .'";'."\n"; ++$counter; } if ($media && !empty($import)) { $styles .= "\n".''; } } if (!empty($vars['conditional_styles'])) { $styles .= "\n". $vars['conditional_styles']; } if ($styles) { $vars['styles'] = $styles; } }