You are here

function ctools_process_css_files in Chaos Tool Suite (ctools) 6

Create a list of CSS files to add to the page.

Parameters

$css_files: Array of css files that are loaded on this page. Passed by reference and previous values are wiped.

$css: Array returned from drupal_add_css() or $variables['css'] from hook_preprocess_page.

1 call to ctools_process_css_files()
ctools_ajax_page_preprocess in includes/ajax.inc
Implement hook_preprocess_page. Process variables for page.tpl.php

File

includes/ajax.inc, line 723
Utilize the CTools AJAX responder.

Code

function ctools_process_css_files(&$css_files, $css) {

  // Go through all CSS files that are being added to the page and catalog them.
  $css_files = array();
  foreach ($css as $media => $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)) {
          $css_files[base_path() . $file] = TRUE;
        }
      }
    }
  }
}