You are here

function advagg_unlimited_css_import in Advanced CSS/JS Aggregation 7

Same name and namespace in other branches
  1. 6 advagg.module \advagg_unlimited_css_import()

Use import tags for CSS

Parameters

$files: array of css files ($media, $href)

&$styles: html string

1 call to advagg_unlimited_css_import()
advagg_unlimited_css_builder in includes/css.inc
Logic to figure out what kind of css tags to use.

File

includes/css.inc, line 432

Code

function advagg_unlimited_css_import($files, &$styles) {
  $counter = 0;
  $media = NULL;
  $import = '';
  foreach ($files as $css_file) {
    $media_new = $css_file['media'];
    $href = $css_file['href'];
    if ($media_new != $media || $counter > variable_get('advagg_css_count_threshold', ADVAGG_CSS_COUNT_THRESHOLD)) {
      if ($media && !empty($import)) {
        $styles .= "\n" . '<style type="text/css" media="' . $media . '">' . "\n" . $import . '</style>';
        $import = '';
      }
      $counter = 0;
      $media = $media_new;
    }
    $import .= '@import "' . $href . '";' . "\n";
    $counter++;
  }
  if ($media && !empty($import)) {
    $styles .= "\n" . '<style type="text/css" media="' . $media . '">' . "\n" . $import . '</style>';
  }
}