You are here

function advagg_unlimited_css_import in Advanced CSS/JS Aggregation 6

Same name and namespace in other branches
  1. 7 includes/css.inc \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 ./advagg.module
Logic to figure out what kind of css tags to use.

File

./advagg.module, line 2335
Advanced CSS/JS aggregation module

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>';
  }
}