You are here

function link_css_css_alter in Link CSS 7

Same name and namespace in other branches
  1. 8 link_css.module \link_css_css_alter()

Implements hook_css_alter().

File

./link_css.module, line 33
Link CSS Module.

Code

function link_css_css_alter(&$css) {
  $count = 0;
  if (!variable_get('preprocess_css')) {
    foreach ($css as $key => $value) {

      // Skip core files.
      $is_core = strpos($value['data'], 'misc/') === 0 || strpos($value['data'], 'modules/') === 0;
      if ((!variable_get('link_css_skip_system', TRUE) || !$is_core) && file_exists($value['data'])) {

        // This option forces embeding with a link element.
        $css[$key]['preprocess'] = FALSE;
        $count++;
      }
    }

    // Show IE warning.
    if (variable_get('link_css_warn_ie_limit', TRUE) && $count > 31) {
      drupal_set_message(t('Internet Explorer <=7 which will not load more than 31
        linked stylesheets. The current page links to @count. Disable Link CSS
        module or turn on CSS aggregation to ensure compatibility.', array(
        '@count' => $count,
      )), 'warning');
    }
  }
}